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:
|
include_compiled |
logical value indicating if compiled functions called with |
skip_globals |
optional character vector of names to skip/exclude as (unrecognized) global variables. |
Value
list S3-object of class "checkglobals"
with three components:
-
globals
, list of class"checkglobalsg"
-
imports
, list of class"checkglobalsi"
-
missing_packages
, character vector with missing packages
for programmatic use, cast the returned S3-object with as.data.frame
, as.matrix
,
as.character
or as_vector
.
See Also
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"
)