rtcl: R Tools for the Command Line
This package ships some command line utilities which simplify working with R packages from the command line. Many commands rtcl provides are just wrappers around , e.g. remotes and testthat. They ensure a valid exit code which is required to use these commands for shell scripting. You find additional packages via R infrastructure. Furthermore, rtcl allows you to maintain a collection of you favorite packages in a plain text file which you can add to your dotfiles and share across systems. This file may also contain git sources to keep you up to date with packages not yet released on CRAN.
rbuildto bundle a local package.
rcheckto check a local package.
.[o|so]files from a local package.
rcovto test the coverage of a local package.
rdocto document a local package using roxygen.
rhubto upload a local package to rhub service.
rinstallto install a remote package, e.g. a package hosted on CRAN or GitHub.
rknitto knit a document (.Rnw, .Rmd, ...) via rknit.
rmaketo make a local package (document and install).
rpkgdownto build static HTML documentation with pkgdown.
rremoveto remove (uninstall) R packages.
rshineto run a shiny app.
rspellto check spelling in generated .Rd files.
rtestto test a local package.
rupdateto update all CRAN packages on your system, install missing CRAN packages listed in your collection
~/.rtcl/packagesand update all packages with a git source.
rusageto check variable usage.
rwinbuildto upload a local package to the winbuilder service.
Call the respective command with
--help to list available command line arguments.
All commands are also available as regular R functions, using the same names.
First, you need to install rtcl itself.
Using a personal library (e.g.,
echo 'R_LIBS_USER=~/.R/library' >> ~/.Renviron) is strongly advised.
Alternatively, if you start from scratch and do not have remotes installed, run the following command in your shell:
Rscript -e 'install.packages("remotes", repos = "http://cloud.r-project.org/")' Rscript -e 'remotes::install_github("rdatsci/rtcl")'
The rtcl command line scripts are now installed in the subdirectory
rtcl/bin of your R library (call
.libPaths() in R if
unsure about its location). You need to add this directory to your
PATH variable, see the section below that applies to you.
Add this directory to your
PATH in your
# bash PATH=~/.R/library/rtcl/bin:$PATH # zsh path=(~/.R/library/rtcl/bin $path) # fish if test -d ~/.R/library/rtcl set -gx PATH $HOME/.R/library/rtcl/bin $PATH end
Add this directory to your
PATH variable in the system environment via the control panel.
As an alternative use the admin console command:
SETX /M PATH "%PATH%;path-to-rtcl-repository/win"
/M changes the
HKEY_LOCAL_MACHINE instead of
If it does not work for you, try it without the
In any case you need to open a new windows prompt or terminal windows in order to reload the
Continue for both Systems
After sourcing this file (or after a re-login) you should be all set to use rtcl.
To keep rtcl updated, you can let it maintain itself via
rupdate by adding it to your collection file
To do this, first initialize an empty collection with
and then edit the file with your favorite text editor.
To add more packages to your collection, see
?rupdate for a format description of this file.
You can also edit the package collection file by calling:
rwinbuild and rhub: maintainer
If you want to check packages on rhub or with the winbuilder that are not yours, you have to change the maintainer temporarily.
rtcl does that for you if you configure your maintainer details in
You can edit this file with any text editor or by calling: