Learn R Programming

xfun (version 0.48)

Supporting Functions for Packages Maintained by 'Yihui Xie'

Description

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

Copy Link

Version

Install

install.packages('xfun')

Monthly Downloads

1,206,097

Version

0.48

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

October 3rd, 2024

Functions in xfun (0.48)

base_pkgs

Get base R package names
dir_create

Create a directory recursively by default
dir_exists

Test the existence of files and directories
base64_encode

Encode/decode data into/from base64 encoding.
base64_uri

Generate the Data URI for a file
download_cache

Download a file from a URL and cache it on disk
embed_file

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

Parse comma-separated chunk options
crandalf_check

Submit check jobs to crandalf
download_file

Try various methods to download a file
env_option

Retrieve a global option from both options() and environment variables
Rscript

Run the commands Rscript and R CMD
github_releases

Get the tags of GitHub releases of a repository
Rscript_call

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

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

Format numbers of bytes using a specified unit
from_root

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

Evaluate an expression after forcing the decimal point to be a dot
del_empty_dir

Delete an empty directory
fenced_block

Create a fenced block in Markdown
is_sub_path

Test if a path is a subpath of a dir
is_web_path

Test if a path is a web path
is_ascii

Check if a character vector consists of entirely ASCII characters
record_print

Print methods for record()
news2md

Convert package news to the Markdown format
process_file

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

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

Create a local web application
file_ext

Manipulate filename extensions
relative_path

Get the relative path of a path relative to a directory
do_once

Perform a task once in an R session
is_blank

Test if a character vector consists of blank strings
divide_chunk

Divide chunk options from the code chunk body
lazy_save

Save objects to files and lazy-load them
broken_packages

Find out broken packages and reinstall them
in_dir

Evaluate an expression under a specified working directory
mark_dirs

Mark some paths as directories
install_dir

Install a source package from a directory
md5

Calculate the MD5 checksums of R objects
alnum_id

Generate ID strings
attr

Obtain an attribute of an object without partial matching
md_table

Generate a simple Markdown pipe table
read_all

Read all text files and concatenate their content
magic_path

Find a file or directory under a root directory
read_bin

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

Read / write files encoded in UTF-8
normalize_path

Normalize paths
record

Run R code and record the results
submit_cran

Submit a source package to CRAN
strip_html

Strip HTML tags
numbers_to_words

Convert numbers to English words
parse_only

Parse R code and do not keep the source
mime_type

Get the MIME types of files
proj_root

Return the (possible) root directory of a project
pkg_attach

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

Type a character vector into the RStudio source editor
prose_index

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

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

A simple JSON serializer
tree

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

Split source lines into complete expressions
retry

Retry calling a function for a number of times
bump_version

Bump version numbers
rev_check

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

Run system2() and mark its character output as UTF-8 if appropriate
strict_list

Strict lists
tinify

Use the Tinify API to compress PNG and JPEG images
valid_syntax

Check if the syntax of the code is valid
cache_exec

Cache the execution of an expression in memory or on disk
upload_ftp

Upload to an FTP server via curl
file_rename

Rename files and directories
file_string

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

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

Partition the YAML metadata and the body in a document
html_tag

Tools for HTML tags
gsub_file

Search and replace strings in files
optipng

Run OptiPNG on all PNG files under a directory
is_windows

Test for types of operating systems
existing_files

Find file paths that exist
exit_call

Call on.exit() in a parent function
rename_seq

Rename files with a sequential numeric prefix
upload_imgur

Upload an image to imgur.com
rest_api

Get data from a REST API
msg_cat

Generate a message with cat()
install_github

An alias of remotes::install_github()
is_abs_path

Test if paths are relative or absolute
isFALSE

Test if an object is FALSE
is_R_CMD_check

Some utility functions for checking packages
shrink_images

Shrink images to a maximum width
native_encode

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

Split a character vector by line breaks
url_accessible

Test if a URL is accessible
protect_math

Protect math expressions in pairs of backticks in Markdown
url_filename

Extract filenames from a URLs
raw_string

Print a character vector in its raw form
session_info

An alternative to sessionInfo() to print session information
set_envvar

Set environment variables
try_error

Try an expression and see if it throws an error
yaml_load

Read YAML data
try_silent

Try to evaluate an expression silently
bg_process

Start a background process