Cast an S3-object of class "checkglobals"
to a data.frame.
Usage
# S3 method for class '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 %>% <NA> global
#> 2 fAttach2 <NA> global
#> 3 fLoad2 <NA> global
#> 4 g <NA> global
#> 5 R6Class R6 import
#> 6 is.unit grid import
#> 7 getMethod methods import
#> 8 setGeneric methods import
#> 9 setMethod methods import
#> 10 pvec parallel import
#> 11 aggregate stats import
#> 12 approxfun stats import
#> 13 coef stats import
#> 14 median stats import
#> 15 sd stats import
#> 16 coef stats4 import
#> 17 globalVariables utils import
#> 18 head utils import
#> 19 maintainer utils import
#> 20 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