Individual session check function that inspects the loaded namespaces. Session checkers can produce errors, warnings, or messages if requested.
Usage
check_loaded_namespaces(
action = "warn",
allow_loaded_namespaces = NULL,
action_on_pass = "none"
)Arguments
- action
Behavior to take if the status is not clean. Possible values are "error", "warn", "message", and "none". The default is
action = "warn".- allow_loaded_namespaces
Character vector containing names of packages that are "allowed", and will not trigger an action if loaded via namespace. The default is
allow_loaded_namespaces = NULL, in which case only base-priority packages and the sessioncheck namespace itself are allowed.- action_on_pass
Behavior to take if the status is clean. Possible values are "message" and "none". The default is
action_on_pass = "none".
Details
This checker inspects the list of loaded namespaces
(packages that have been loaded but not attached). Regardless of the value of
allow_loaded_namespaces, R packages that have "base" priority (e.g., base, utils, and
grDevices) do not trigger an action, nor does the sessioncheck package itself,
since the package namespace must be loaded in order to call the function.
Examples
check_loaded_namespaces(action = "message")
#> ✖ Unexpected namespaces: jsonlite, brio, xml2, jquerylib, and 42 more
# a session with no unexpected namespaces loaded: `action` only controls
# what happens when a problem *is* found, so use `action_on_pass = "message"`
# to confirm the clean result instead
check_loaded_namespaces(
action = "none",
allow_loaded_namespaces = loadedNamespaces(),
action_on_pass = "message"
)
#> ✔ No unexpected namespaces loaded