Skip to contents

Cast an S3-object of class "checkglobalsi" to a list vector.

Usage

# S3 method for checkglobalsi
as_vector(x, pattern, ...)

Arguments

x

object inheriting from class "checkglobalsi".

pattern

an optional regular expression. Only names matching pattern are returned. glob2rx can be used to convert wildcard patterns to regular expressions.

...

additional arguments to configure the output:

  • all.names, a logical value. If TRUE, all object names are returned. If FALSE, names which begin with a . are omitted. Defaults to TRUE.

  • sorted, a logical value indicating if the function/variable names should be sorted alphabetically. Defaults to TRUE.

Value

a list consisting of two character vectors:

  • import, vector of import function/variable names.

  • package, vector of import package names.

Examples

## R-package from folder
chk <- checkglobals(
  pkg = system.file(
    "unit_tests", "pkg", "testpkg",
    package = "checkglobals"
  )
)
as_vector(chk$imports)
#> $import
#>  [1] "R6Class"         "aggregate"       "approxfun"       "coef"           
#>  [5] "getMethod"       "globalVariables" "head"            "is.unit"        
#>  [9] "median"          "pvec"            "setGeneric"      "setMethod"      
#> [13] "tail"           
#> 
#> $package
#> [1] "R6"       "grid"     "methods"  "parallel" "stats"    "stats4"   "utils"   
#>