Cast an S3-object of class "checkglobals"
to a data.frame.
Usage
# S3 method for checkglobals
as.data.frame(
x,
row.names = NULL,
optional = FALSE,
pattern,
which = c("global", "import"),
...
)
Arguments
- x
object inheriting from class
"checkglobals"
.- row.names
currently not used, included for compatibility with
as.data.frame
generic.- optional
currently not used, included for compatibility with
as.data.frame
generic.- pattern
an optional regular expression. Only names matching
pattern
are returned.glob2rx
can be used to convert wildcard patterns to regular expressions.- which
a character vector, either
"global"
to print all unrecognized global variables,"import"
to print all detected imported functions and variables, or both (default).- ...
additional arguments to configure the output:
all.names
, a logical value. IfTRUE
, all object names are returned. IfFALSE
, names which begin with a . are omitted. Defaults toTRUE
.sorted
, a logical value indicating if the function/variable names should be sorted alphabetically. Defaults toTRUE
.
Value
a data.frame with three character columns:
name
, the name of the global or imported function/variable.package
, the import package, only applies to imported functions/variables.type
, the type of the detected entity, either"global"
or "import".
Examples
## R-package from folder
chk <- checkglobals(
pkg = system.file(
"unit_tests", "pkg", "testpkg",
package = "checkglobals"
)
)
as.data.frame(chk)
#> name package type
#> 1 g <NA> global
#> 2 R6Class R6 import
#> 3 is.unit grid import
#> 4 getMethod methods import
#> 5 setGeneric methods import
#> 6 setMethod methods import
#> 7 pvec parallel import
#> 8 aggregate stats import
#> 9 approxfun stats import
#> 10 coef stats import
#> 11 median stats import
#> 12 coef stats4 import
#> 13 globalVariables utils import
#> 14 head utils import
#> 15 tail utils import
## include only selected imports
as.data.frame(chk, pattern = "coef", which = "import")
#> name package type
#> 1 coef stats import
#> 2 coef stats4 import