Package: xfun 0.45.1

xfun: Supporting Functions for Packages Maintained by 'Yihui Xie'

Miscellaneous functions commonly used in other packages maintained by 'Yihui Xie'.

Authors:Yihui Xie [aut, cre, cph], Wush Wu [ctb], Daijiang Li [ctb], Xianying Tan [ctb], Salim Br├╝ggemann [ctb], Christophe Dervieux [ctb], Posit Software, PBC [cph, fnd]

xfun.pdf |xfun.html
xfun/json (API)

# Install xfun in R:
install.packages('xfun', repos = c('', ''))

Peer review:

Bug tracker:


137 exports 134 stars 16.80 score 0 dependencies 3959 dependents 1.0M downloads

Last updated 5 days agofrom:dc149f3ead04829f9b38f98dd44e6503ce5d6d47



An Introduction to xfun

Rendered fromxfun.Rmdusingknitr::knitron Jun 18 2024.

Last update: 2024-06-16
Started: 2018-06-15

Readme and manuals

Help Manual

Help pageTopics
Generate ID stringsalnum_id
Obtain an attribute of an object without partial matchingattr
Get base R package namesbase_pkgs
Encode/decode data into/from base64 encoding.base64_decode base64_encode
Generate the Data URI for a filebase64_uri
Start a background processbg_process
Find out broken packages and reinstall thembroken_packages
Bump version numbersbump_version
Cache the execution of an expression in memory or on diskcache_exec
Cache the value of an R expression to an RDS filecache_rds
Submit check jobs to crandalfcrandalf_check crandalf_results
Parse comma-separated chunk optionscsv_options
Evaluate an expression after forcing the decimal point to be a dotdecimal_dot
Delete an empty directorydel_empty_dir
Create a directory recursively by defaultdir_create
Test the existence of files and directoriesdir_exists file_exists
Divide chunk options from the code chunk bodydivide_chunk
Perform a task once in an R sessiondo_once
Download a file from a URL and cache it on diskdownload_cache
Try various methods to download a filedownload_file
Embed a file, multiple files, or directory on an HTML pageembed_dir embed_file embed_files
Retrieve a global option from both 'options()' and environment variablesenv_option
Find file paths that existexisting_files
Call 'on.exit()' in a parent functionexit_call
Create a fenced block in Markdownfenced_block fenced_div make_fence
Manipulate filename extensionsfile_ext sans_ext with_ext
Read a text file and concatenate the lines by ''\n''file_string
Format numbers of bytes using a specified unitformat_bytes
Get the relative path of a path in a project relative to the current working directoryfrom_root
Get the tags of GitHub releases of a repositorygithub_releases
Perform replacement with 'gsub()' on elements matched from 'grep()'grep_sub
Search and replace strings in filesgsub_dir gsub_ext gsub_file gsub_files
Evaluate an expression under a specified working directoryin_dir
Install a source package from a directoryinstall_dir
An alias of 'remotes::install_github()'install_github
Test if paths are relative or absoluteis_abs_path is_rel_path
Check if a character vector consists of entirely ASCII charactersis_ascii
Test if a character vector consists of blank stringsis_blank
Test if a path is a subpath of a diris_sub_path
Test if a path is a web pathis_web_path
Test for types of operating systemsis_arm64 is_linux is_macos is_unix is_windows
Find a file or directory under a root directorymagic_path
Mark some paths as directoriesmark_dirs
Generate a simple Markdown pipe tablemd_table
Calculate the MD5 checksums of R objectsmd5
Generate a message with 'cat()'msg_cat
Try to use the system native encoding to represent a character vectornative_encode
Create a local web applicationnew_app
Convert package news to the Markdown formatnews2md
Normalize pathsnormalize_path
Convert numbers to English wordsn2w numbers_to_words
Run OptiPNG on all PNG files under a directoryoptipng
Parse R code and do not keep the sourceparse_only
Attach or load packages, and automatically install missing packages if requestedloadable pkg_attach pkg_attach2 pkg_available pkg_load pkg_load2
Kill a process and (optionally) all its child processesproc_kill
Read a text file, process the text with a function, and write the text backprocess_file sort_file
Return the (possible) root directory of a projectproj_root root_rules
Find the indices of lines in Markdown that are prose (not code blocks)prose_index
Protect math expressions in pairs of backticks in Markdownprotect_math
Print a character vector in its raw formprint.xfun_raw_string raw_string
Read all text files and concatenate their contentread_all
Read all records of a binary file as a raw vector by defaultread_bin
Read / write files encoded in UTF-8append_unique append_utf8 read_utf8 write_utf8
Run R code and record the resultsformat.xfun_record_results print.xfun_record_results record
Print methods for 'record()'new_record record_print record_print.default
Get the relative path of a path relative to a directoryrelative_path
Rename files with a sequential numeric prefixrename_seq
Get data from a REST APIgithub_api rest_api rest_api_raw
Retry calling a function for a number of timesretry
Run 'R CMD check' on the reverse dependencies of a packagecompare_Rcheck rev_check
Run the commands 'Rscript' and 'R CMD'Rcmd Rscript
Call a function in a new R session via 'Rscript()'Rscript_call
Type a character vector into the RStudio source editorrstudio_type
Test if two paths are the same after they are normalizedsame_path
An alternative to sessionInfo() to print session informationsession_info
Set environment variablesset_envvar
Shrink images to a maximum widthshrink_images
Split a character vector by line breakssplit_lines
Split source lines into complete expressionssplit_source
Strict lists$.xfun_strict_list as_strict_list print.xfun_strict_list strict_list
Strip HTML tagsstrip_html
Submit a source package to CRANsubmit_cran
Run 'system2()' and mark its character output as UTF-8 if appropriatesystem3
Use the Tinify API to compress PNG and JPEG imagestinify tinify_dir
A simple JSON serializerjson_vector tojson
Turn the output of 'str()' into a tree diagramtree
Try an expression and see if it throws an errortry_error
Try to evaluate an expression silentlytry_silent
Upload to an FTP server via 'curl'upload_ftp upload_win_builder
Upload an image to imgur.comupload_imgur
Test if a URL is accessibleurl_accessible
Extract filenames from a URLsurl_filename
Check if the syntax of the code is validvalid_syntax
Partition the YAML metadata and the body in a documentyaml_body
Read YAML datayaml_load