View source: R/require_namespaces.R
require_namespaces | R Documentation |
Packages are loaded (not attached) via base::requireNamespace()
.
If at least on package can not be loaded, an exception of class "packageNotFoundError" is raised.
The character vector of missing packages is stored in the condition as packages
.
require_namespaces(
pkgs,
msg = "The following packages could not be loaded: %s",
quietly = FALSE
)
pkgs |
( |
msg |
( |
quietly |
( |
(character()
) of loaded packages (invisibly).
require_namespaces("mlr3misc")
# catch condition, return missing packages
tryCatch(require_namespaces(c("mlr3misc", "foobaaar")),
packageNotFoundError = function(e) e$packages)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.