This function will check a source package.
Usage
pkg_check(
pkgid,
src_pkgs = get_srcpkgs(),
lib = ".check",
roxygen = TRUE,
quiet = FALSE,
error_on = "error",
check_system_clock = FALSE,
...
)Arguments
- pkgid
a package name, path or package object
- src_pkgs
a collection of source packages as a
srckgsobject.- lib
directory where to install and find installed pkgs
- roxygen
whether to roxygenize
- quiet
whether to be quiet/silent
- error_on
passed to
devtools::check()- check_system_clock
if FALSE, disable the
_R_CHECK_SYSTEM_CLOCK_check. This check sometimes fail because of firewalls...- ...
passed to
devtools::check()
Examples
# \donttest{
pkg <- setup_and_get_dummy_srcpkg()
res <- pkg_check(pkg, lib = tempfile(), error_on = "never")
#> ══ Building ════════════════════════════════════════════════════════════════════
#> Setting env vars:
#> • CFLAGS : -Wall -pedantic -fdiagnostics-color=always
#> • CXXFLAGS : -Wall -pedantic -fdiagnostics-color=always
#> • CXX11FLAGS: -Wall -pedantic -fdiagnostics-color=always
#> • CXX14FLAGS: -Wall -pedantic -fdiagnostics-color=always
#> • CXX17FLAGS: -Wall -pedantic -fdiagnostics-color=always
#> • CXX20FLAGS: -Wall -pedantic -fdiagnostics-color=always
#> ── R CMD build ─────────────────────────────────────────────────────────────────
#> * checking for file ‘/tmp/RtmpdftqsK/file1e6c79419f06/dummy_srcpkg/DESCRIPTION’ ... OK
#> * preparing ‘dummy.srcpkg’:
#> * checking DESCRIPTION meta-information ... OK
#> * checking for LF line-endings in source and make files and shell scripts
#> * checking for empty or unneeded directories
#> Removed empty directory ‘dummy.srcpkg/man’
#> * building ‘dummy.srcpkg_3.1416.tar.gz’
#>
#> ══ Checking ════════════════════════════════════════════════════════════════════
#> Setting env vars:
#> • _R_CHECK_CRAN_INCOMING_REMOTE_ : FALSE
#> • _R_CHECK_CRAN_INCOMING_ : FALSE
#> • _R_CHECK_FORCE_SUGGESTS_ : FALSE
#> • _R_CHECK_PACKAGES_USED_IGNORE_UNUSED_IMPORTS_: FALSE
#> • NOT_CRAN : true
#> ── R CMD check ─────────────────────────────────────────────────────────────────
#> * using log directory ‘/tmp/RtmpdftqsK/file1e6c14956160/dummy.srcpkg.Rcheck’
#> * using R version 4.5.1 (2025-06-13)
#> * using platform: x86_64-pc-linux-gnu
#> * R was compiled by
#> gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
#> GNU Fortran (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
#> * running under: Ubuntu 24.04.3 LTS
#> * using session charset: UTF-8
#> * using options ‘--no-manual --as-cran’
#> * checking for file ‘dummy.srcpkg/DESCRIPTION’ ... OK
#> * this is package ‘dummy.srcpkg’ version ‘3.1416’
#> * package encoding: UTF-8
#> * checking package namespace information ... OK
#> * checking package dependencies ... OK
#> * checking if this is a source package ... OK
#> * checking if there is a namespace ... OK
#> * checking for executable files ... OK
#> * checking for hidden files and directories ... NOTE
#> Found the following hidden files and directories:
#> .SRCPKGS_MD5
#> These were most likely included in error. See section ‘Package
#> structure’ in the ‘Writing R Extensions’ manual.
#> * checking for portable file names ... OK
#> * checking for sufficient/correct file permissions ... OK
#> * checking serialization versions ... OK
#> * checking whether package ‘dummy.srcpkg’ can be installed ... OK
#> * checking installed package size ... OK
#> * checking package directory ... OK
#> * checking for future file timestamps ... OK
#> * checking DESCRIPTION meta-information ... OK
#> * checking top-level files ... OK
#> * checking for left-over files ... OK
#> * checking index information ... OK
#> * checking package subdirectories ... OK
#> * checking code files for non-ASCII characters ... OK
#> * checking R files for syntax errors ... OK
#> * checking whether the package can be loaded ... OK
#> * checking whether the package can be loaded with stated dependencies ... OK
#> * checking whether the package can be unloaded cleanly ... OK
#> * checking whether the namespace can be loaded with stated dependencies ... OK
#> * checking whether the namespace can be unloaded cleanly ... OK
#> * checking loading without being on the library search path ... OK
#> * checking dependencies in R code ... OK
#> * checking S3 generic/method consistency ... OK
#> * checking replacement functions ... OK
#> * checking foreign function calls ... OK
#> * checking R code for possible problems ... OK
#> * checking for missing documentation entries ... OK
#> * checking examples ... NONE
#> * checking for unstated dependencies in ‘tests’ ... OK
#> * checking tests ...
#> Running ‘testthat.R’
#> ERROR
#> Running the tests in ‘tests/testthat.R’ failed.
#> Last 13 lines of output:
#> > library(testthat)
#> > suppressPackageStartupMessages(library(dummy.srcpkg))
#> >
#> > test_check("dummy.srcpkg")
#> [ FAIL 1 | WARN 0 | SKIP 0 | PASS 1 ]
#>
#> ══ Failed tests ════════════════════════════════════════════════════════════════
#> ── Failure ('test_failure.R:3:3'): does_nothing_special - failure ──────────────
#> does_nothing_special() not equal to 0.
#> 1/1 mismatches
#> [1] 42 - 0 == 42
#>
#> [ FAIL 1 | WARN 0 | SKIP 0 | PASS 1 ]
#> Error: Test failures
#> Execution halted
#> * checking for non-standard things in the check directory ... OK
#> * checking for detritus in the temp directory ... OK
#> * DONE
#>
#> Status: 1 ERROR, 1 NOTE
#> See
#> ‘/tmp/RtmpdftqsK/file1e6c14956160/dummy.srcpkg.Rcheck/00check.log’
#> for details.
#>
print(res)
#> ── R CMD check results ──────────────────────────────── dummy.srcpkg 3.1416 ────
#> Duration: 7.5s
#>
#> ❯ checking tests ...
#> See below...
#>
#> ❯ checking for hidden files and directories ... NOTE
#> Found the following hidden files and directories:
#> .SRCPKGS_MD5
#> These were most likely included in error. See section ‘Package
#> structure’ in the ‘Writing R Extensions’ manual.
#>
#> ── Test failures ───────────────────────────────────────────────── testthat ────
#>
#> > # This file is part of the standard setup for testthat.
#> > # It is recommended that you do not modify it.
#> > #
#> > # Where should you do additional test configuration?
#> > # Learn more about the roles of various files in:
#> > # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
#> > # * https://testthat.r-lib.org/articles/special-files.html
#> >
#> > library(testthat)
#> > suppressPackageStartupMessages(library(dummy.srcpkg))
#> >
#> > test_check("dummy.srcpkg")
#> [ FAIL 1 | WARN 0 | SKIP 0 | PASS 1 ]
#>
#> ══ Failed tests ════════════════════════════════════════════════════════════════
#> ── Failure ('test_failure.R:3:3'): does_nothing_special - failure ──────────────
#> does_nothing_special() not equal to 0.
#> 1/1 mismatches
#> [1] 42 - 0 == 42
#>
#> [ FAIL 1 | WARN 0 | SKIP 0 | PASS 1 ]
#> Error: Test failures
#> Execution halted
#>
#> package errors warnings notes time
#> 1 dummy.srcpkg 1 0 1 7.490038
# }