print.checkglobals {checkglobals} | R Documentation |
Print "checkglobals"
object
Description
Print method for S3-objects of class "checkglobals"
as returned by checkglobals
,
check_pkg
or check_source
. Prints the name and location
of all unrecognized global variables; and the name and location of all detected imported functions
grouped by R-package. The location consists of the source file name and line number. If
cli is installed and cli-hyperlinks are supported in the console,
clicking the location links opens the source file at the given line number. The bars printed behind the
import package names are filled based on the absolute number of detected imports per package.
Usage
## S3 method for class 'checkglobals'
print(
x,
format = c("basic", "detail"),
pattern,
which = c("global", "import"),
...
)
Arguments
x |
object inheriting from class |
format |
character, one of the following two choices:
|
pattern |
an optional regular expression. Only names
matching |
which |
a character vector, either |
... |
additional arguments to configure the printed output. The following arguments can be specified:
|
Value
Returns the object x
invisibly (via invisible
).
See Also
checkglobals
, check_pkg
, check_source
Examples
## R-package from folder
chk <- checkglobals(
pkg = system.file(
"unit_tests", "pkg", "testpkg",
package = "checkglobals"
)
)
chk
## print globals with references to source code
print(chk, format = "detail", which = "global", maxRef = 99)
## print selected imports
print(chk, format = "detail", pattern = "coef", which = "import", maxRef = 99)
## print without cli-formatting
print(chk, use_cli = FALSE)