knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
Run R CMD check from R and Capture Results
Run R CMD check from R programmatically and capture the results of the individual checks.
Install the released version from CRAN
install.packages("rcmdcheck")
Or install the development version from GitHub:
# install.packages("pak") pak::pak("r-lib/rcmdcheck")
library(rcmdcheck) rcmdcheck("path/to/R/package")
Call rcmdcheck()
on a source R package .tar.gz
file, or on a folder
containing your R package. Supply quiet = FALSE
if you want to omit the
output. The result of the check is returned, in a list with elements
errors
, warnings
, and notes
. Each element is a character vector,
and one element of the character vectors is a single failure.
rcmdcheck()
returns an rcmdcheck
object, which you can query and
manipulate.
library(rcmdcheck) chk <- rcmdcheck("tests/testthat/bad1", quiet = TRUE) chk
check_details()
turns the check results into a simple lists with the
following information currently:
names(check_details(chk))
package
: Package name.version
: Package version number.notes
: Character vector of check NOTE
s.warnings
: Character vector of check WARNING
s.errors
: Character vector of check ERROR
s.platform
: Platform, e.g. x86_64-apple-darwin15.6.0
.checkdir
: Check directory.install_out
: Output of the package installation.description
: The text of the DESCRIPTION
file.session_info
: A sessioninfo::session_info
object, session information
from within the check process.cran
: Flag, whether this is a CRAN package. (Based on the Repository
field in DESCRIPTION
, which is typically only set for published CRAN
packages.)bioc
: Flag, whether this is a Bioconductor package, based on the
presence of the biocViews
field in DESCRIPTION
.Note that if the check results were parsed from a file, some of these
fields might be missing (NULL
), as we don't have access to the original
DESCRIPTION
, the installation output, etc.
parse_check()
parses check output from a file, parse_check_url()
parses check output from a URL.
rcmdcheck has a functions to access CRAN's package check results.
cran_check_flavours()
downloads the names of the CRAN platforms:
cran_check_flavours()
cran_check_results()
loads and parses all check results for a package.
cran_check_results("igraph")
compare_checks()
can compare two or more rcmdcheck
objects.
compare_to_cran()
compares an rcmdcheck
object to the CRAN checks of
the same package:
chk <- rcmdcheck(quiet = TRUE) compare_to_cran(chk)
rcmdcheck_process
is a processx::process
class, that can run
R CMD check
in the background. You can also use this to run multiple
checks concurrently. processx::process
methods can be used to poll or
manipulate the check processes.
chkpx <- rcmdcheck_process$new() chkpx
chkpx$wait() chkpx$parse_results()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.