devtools (version 1.5)

check: Build and check a package, cleaning up automatically on success.

Description

check automatically builds and checks a source package, using all know best practices. Passing R CMD check is essential if you want to submit your package to CRAN: you must not have an ERRORs or WARNINGs, and you want to ensure that there are as few NOTEs as possible. If you are not submitting to CRAN, at least ensure that there are no ERRORs: these typically represent serious problems.

Usage

check(pkg = ".", document = TRUE,
  doc_clean = getOption("devtools.cleandoc"), cleanup = TRUE, cran = TRUE,
  check_version = FALSE, force_suggests = TRUE, args = NULL,
  build_args = NULL, quiet = FALSE, check_dir = tempdir())

Arguments

pkg
package description, can be path or package name. See as.package for more information
document
if TRUE (the default), will update and check documentation before running formal check.
cleanup
if TRUE the check directory is removed if the check is successful - this allows you to inspect the results to figure out what went wrong. If FALSE the check directory is never removed.
cran
if TRUE (the default), check using the same settings as CRAN uses.
doc_clean
If TRUE, will delete all files in the man directory and regenerate them from scratch with roxygen. The default is to use the value of the "devtools.cleandoc" option.
check_version
if TRUE, check that the new version is greater than the current version on CRAN, by setting the _R_CHECK_CRAN_INCOMING_ environment variable to TRUE.
force_suggests
if FALSE, don't force suggested packages, by setting the _R_CHECK_FORCE_SUGGESTS_ environment variable to FALSE.
args,build_args
An optional character vector of additional command
quiet
if TRUE suppresses output from this function.
check_dir
the directory in which the package is checked

Environment variables

Devtools does it's best to set up an environment that combines best practices with how check works on CRAN. This includes:

  • The standard environment variables set by devtools:r_env_vars. Of particular note for package tests is theNOT_CRANenv var which lets you know that your tests are not running on cran, and hence can take a reasonable amount of time.
  • Debugging flags for the compiler, set bycompiler_flags(FALSE).
  • Special environment variables set to the same values that CRAN uses when testing packages:cran_env_vars. Unforutnately exactly what CRAN does when checking a package is not publicly documented, but we do our best to simulate as accurately as possible given what we know.

Details

check automatically builds a package before using R CMD check as this is the recommended way to check packages. Note that this process runs in an independent realisation of R, so nothing in your current workspace will affect the process.

See Also

release if you want to send the checked package to CRAN.