Skip to contents

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

Usage

# S3 method for checkglobalsi
as.matrix(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 matrix similar in format to as.matrix.checkglobals.

Examples

## R-package from folder
chk <- checkglobals(
  pkg = system.file(
    "unit_tests", "pkg", "testpkg",
    package = "checkglobals"
  )
)
as.matrix(chk$imports)
#>       name              package    type    
#>  [1,] "R6Class"         "R6"       "import"
#>  [2,] "is.unit"         "grid"     "import"
#>  [3,] "getMethod"       "methods"  "import"
#>  [4,] "setGeneric"      "methods"  "import"
#>  [5,] "setMethod"       "methods"  "import"
#>  [6,] "pvec"            "parallel" "import"
#>  [7,] "aggregate"       "stats"    "import"
#>  [8,] "approxfun"       "stats"    "import"
#>  [9,] "coef"            "stats"    "import"
#> [10,] "median"          "stats"    "import"
#> [11,] "coef"            "stats4"   "import"
#> [12,] "globalVariables" "utils"    "import"
#> [13,] "head"            "utils"    "import"
#> [14,] "tail"            "utils"    "import"