check_pkg {checkglobals}R Documentation

Check R-packages for globals and imports

Description

Approximately detect global and imported functions or variables from R-packages by static code analysis. Conceptually, the function inspects all files in the package R-folder and contrasts the detected (unrecognized) globals and imports against the imports listed in the NAMESPACE of the R-package. R-scripts present elsewhere in the package (i.e. not in the R-folder) are not scanned, as these are not coupled to the package NAMESPACE file.

Usage

check_pkg(pkg = ".", include_compiled = FALSE, skip_globals = NULL)

Arguments

pkg

character path to R-package, can be either:

  • a local R-package folder;

  • path to bundled (tar.gz) R-package on local filesystem;

  • remote path to bundled (tar.gz) R-package, (e.g. a remote server or the web).

include_compiled

logical value indicating if compiled functions called with .Call, .C, .External, .Fortran should be included as global variables.

skip_globals

optional character vector of names to skip/exclude as (unrecognized) global variables.

Value

list S3-object of class "checkglobals" with three components:

for programmatic use, cast the returned S3-object with as.data.frame, as.matrix, as.character or as_vector.

See Also

checkglobals, check_source

Examples

## from R-package folder
check_pkg(
  pkg = system.file(
    "unit_tests", "pkg", "testpkg",
    package = "checkglobals"
  )
)

## from bundled R-package

  check_pkg(
    pkg = "https://cran.r-project.org/src/contrib/tinytest_1.4.1.tar.gz",
    skip_globals = "cluster"
  )


[Package checkglobals version 0.1.0 Index]