Customizing Package Build Options in the RStudio IDE


Customizing Package Build Options


There are three R package build commands used by the package development tools in the RStudio IDE:

  • R CMD check
  • R CMD build

It's possible to customize the options passed to each of these commands using Project Options : Build Tools:

To obtain a summary of the valid options simply execute the command with the --help option in ain a terminal window. For example:

R CMD check --help

The following sections include the output of --help for each of these commands for R version 3.1.2.


R CMD check

Usage: R CMD check [options] pkgs

Check R packages from package sources, which can be directories or
package 'tar' archives with extension '.tar.gz', '.tar.bz2',
'.tar.xz' or '.tgz'.

A variety of diagnostic checks on directory structure, index and
control files are performed. The package is installed into the log
directory and production of the package PDF manual is tested.
All examples and tests provided by the package are tested to see if
they run successfully. Code in the vignettes is tested,
as is re-building the vignette PDFs.

-h, --help print short help message and exit
-v, --version print version info and exit
-l, --library=LIB library directory used for test installation
of packages (default is outdir)
-o, --output=DIR directory for output, default is current directory.
Logfiles, R output, etc. will be placed in 'pkg.Rcheck'
in this directory, where 'pkg' is the name of the
checked package
--no-clean do not clean 'outdir' before using it
--no-codoc do not check for code/documentation mismatches
--no-examples do not run the examples in the Rd files
--no-install skip installation and associated tests
--no-tests do not run code in 'tests' subdirectory
--no-manual do not produce the PDF manual
--no-vignettes do not run R code in vignettes
--no-build-vignettes do not build vignette outputs
--use-gct use 'gctorture(TRUE)' when running examples/tests
--use-valgrind use 'valgrind' when running examples/tests/vignettes
--timings record timings for examples
--install-args= command-line args to be passed to INSTALL
run checks on the package subdirectories
(default is yes for a tarball, no otherwise)
--as-cran select customizations similar to those used
for CRAN incoming checking

The following options apply where sub-architectures are in use:
--extra-arch do only runtime tests needed for an additional
--multiarch do runtime tests on all installed sub-archs
--no-multiarch do runtime tests only on the main sub-architecture
--force-multiarch run tests on all sub-archs even for packages
with no compiled code

By default, all test sections are turned on.


R CMD build

Usage: R CMD build [options] pkgdirs

Build R packages from package sources in the directories specified by

-h, --help print short help message and exit
-v, --version print version info and exit

--force force removal of INDEX file
--keep-empty-dirs do not remove empty dirs
--no-build-vignettes do not (re)build package vignettes
--no-manual do not build the PDF manual even if \Sexprs are present
--resave-data= re-save data files as compactly as possible:
"no", "best", "gzip" (default)
--resave-data same as --resave-data=best
--no-resave-data same as --resave-data=no
--compact-vignettes= try to compact PDF files under inst/doc:
"no" (default), "qpdf", "gs", "gs+qpdf", "both"
--compact-vignettes same as --compact-vignettes=qpdf
--md5 add MD5 sums



Usage: R CMD INSTALL [options] pkgs

Install the add-on packages specified by pkgs. The elements of pkgs can
be relative or absolute paths to directories with the package
sources, or to gzipped package 'tar' archives. The library tree
to install to can be specified via '--library'. By default, packages are
installed in the library tree rooted at the first directory in
.libPaths() for an R session run in the current environment

-h, --help print short help message and exit
-v, --version print INSTALL version info and exit
-c, --clean remove files created during installation
--preclean remove files created during a previous run
-d, --debug turn on debugging messages
-l, --library=LIB install packages to library tree LIB
--no-configure do not use the package's configure script
--no-docs do not install HTML, LaTeX or examples help
--html build HTML help
--no-html do not build HTML help
--latex install LaTeX help
--example install R code for help examples
--fake do minimal install for testing purposes
--no-lock install on top of any existing installation
without using a lock directory
--lock use a per-library lock directory (default)
--pkglock use a per-package lock directory
(default for a single package)
--build build binaries of the installed package(s)
--install-tests install package-specific tests (if any)
--no-R, --no-libs, --no-data, --no-help, --no-demo, --no-exec,
suppress installation of the specified part of the
package for testing or other special purposes
--no-multiarch build only the main architecture
--libs-only only install the libs directory
--data-compress= none, gzip (default), bzip2 or xz compression
to be used for lazy-loading of data
--resave-data re-save data files as compactly as possible
--compact-docs re-compress PDF files under inst/doc
use (or not) 'keep.source' for R code
--byte-compile byte-compile R code
--no-byte-compile do not byte-compile R code
--no-test-load skip test of loading installed package
--no-clean-on-error do not remove installed package on error
--merge-multiarch multi-arch by merging (from a single tarball only)

for Unix
set arguments for the configure scripts (if any)
set variables for the configure scripts (if any)
--dsym (OS X only) generate dSYM directory

and on Windows only
--force-biarch attempt to build both architectures
even if there is a non-empty
--compile-both compile both architectures on 32-bit Windows

Which of --html or --no-html is the default depends on the build of R:
for this one it is --no-html.

Related Topics