Learn R Programming

⚠️There's a newer version (0.53) of this package.Take me there.

xfun

This package contains several utility functions that I frequently use in other packages, and also miscellaneous functions that I use by myself from time to time. For more information, see https://yihui.org/xfun/.

To install the package from CRAN, use install.packages('xfun'). To install the development version here, you may set the repos option to https://yihui.r-universe.dev/:

options(repos = c(
  yihui = 'https://yihui.r-universe.dev',
  CRAN = 'https://cloud.r-project.org'
))

install.packages('xfun')

Copy Link

Version

Install

install.packages('xfun')

Monthly Downloads

1,105,778

Version

0.21

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Yihui Xie

Last Published

February 10th, 2021

Functions in xfun (0.21)

exit_call

Call on.exit() in a parent function
install_dir

Install a source package from a directory
numbers_to_words

Convert numbers to English words
file_ext

Manipulate filename extensions
proc_kill

Kill a process and (optionally) all its child processes
github_releases

Get the tags of Github releases of a repository
normalize_path

Normalize paths
process_file

Read a text file, process the text with a function, and write the text back
install_github

An alias of remotes::install_github()
grep_sub

Perform replacement with gsub() on elements matched from grep()
download_file

Try various methods to download a file
embed_file

Embed a file, multiple files, or directory on an HTML page
mark_dirs

Mark some paths as directories
read_bin

Read all records of a binary file as a raw vector by default
do_once

Perform a task once in an R session
read_utf8

Read / write files encoded in UTF-8
is_abs_path

Test if paths are relative or absolute
dir_exists

Test the existence of files and directories
is_ascii

Check if a character vector consists of entirely ASCII characters
magic_path

Find a file or directory under a root directory
dir_create

Create a directory recursively by default
isFALSE

Test if an object is identical to FALSE
file_string

Read a text file and concatenate the lines by '\n'
optipng

Run OptiPNG on all PNG files under a directory
relative_path

Get the relative path of a path relative a directory
is_sub_path

Test if a path is a subpath of a dir
is_windows

Test for types of operating systems
from_root

Get the relative path of a path in a project relative to the current working directory
is_web_path

Test if a path is a web path
tojson

A simple JSON serializer
stringsAsStrings

Set the global option options(stringsAsFactors = FALSE) inside a parent function and restore the option after the parent function exits
proj_root

Return the (possible) root directory of a project
rename_seq

Rename files with a sequential numeric prefix
gsub_file

Search and replace strings in files
same_path

Test if two paths are the same after they are normalized
upload_ftp

Upload to an FTP server via curl
tree

Turn the output of str() into a tree diagram
set_envvar

Set environment variables
prose_index

Find the indices of lines in Markdown that are prose (not code blocks)
url_filename

Extract filenames from a URLs
session_info

An alternative to sessionInfo() to print session information
split_lines

Split a character vector by line breaks
try_silent

Try to evaluate an expression silently
in_dir

Evaluate an expression under a specified working directory
parse_only

Parse R code and do not keep the source
is_R_CMD_check

Some utility functions for checking packages
msg_cat

Generate a message with cat()
native_encode

Try to use the system native encoding to represent a character vector
pkg_attach

Attach or load packages, and automatically install missing packages if requested
protect_math

Protect math expressions in pairs of backticks in Markdown
raw_string

Print a character vector in its raw form
split_source

Split source lines into complete expressions
valid_syntax

Check if the syntax of the code is valid
rev_check

Run R CMD check on the reverse dependencies of a package
strict_list

Strict lists
rstudio_type

Type a character vector into the RStudio source editor
del_empty_dir

Delete an empty directory
base64_uri

Generate the Data URI for a file
bg_process

Start a background process
bump_version

Bump version numbers
cache_rds

Cache the value of an R expression to an RDS file
Rscript_call

Call a function in a new R session via Rscript()
Rscript

Run the commands Rscript and R CMD
attr

Obtain an attribute of an object without partial matching
base64_encode

Encode/decode data into/from base64 encoding.