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