| assert_packages_installed | R Documentation |
Assert that one or more packages are installed.
assert_packages_installed(
x,
msg = NULL,
call = rlang::caller_env(),
arg_name = NULL
)
x |
Package name(s) (character vector) |
msg |
A character string containing the error message to display if the package is not installed |
call |
Only relevant when pooling assertions into multi-assertion helper functions. See cli_abort for details. |
arg_name |
Advanced use only. Name of the argument passed (default: NULL, will automatically extract arg_name). |
invisible(TRUE) if x is installed, otherwise aborts with the
message specified by msg
try({
assert_packages_installed("stats") # Passes
assert_packages_installed(c("stats", "utils")) # Passes
assert_packages_installed("notapackage123") # Throws Error
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.