Are packages installed in any of the libraries?Source:
These functions check that packages are installed with minimal side effects. If installed, the packages will be loaded but not attached.
is_installed()doesn't interact with the user. It simply returns
FALSEdepending on whether the packages are installed.
In interactive sessions,
check_installed()asks the user whether to install missing packages. If the user accepts, the packages are installed with
pak::pkg_install()if available, or
utils::install.packages()otherwise. If the session is non interactive or if the user chooses not to install the packages, the current evaluation is aborted.
You can disable the prompt by setting the
rlib_restart_package_not_found global option to
FALSE. In that
case, missing packages always cause an error.
is_installed(pkg, ..., version = NULL, compare = NULL) check_installed( pkg, reason = NULL, ..., version = NULL, compare = NULL, action = NULL, call = caller_env() )
The package names. Can include version requirements, e.g.
"pkg (>= 1.0.0)".
These dots must be empty.
Minimum versions for
pkg. If supplied, must be the same length as
NAelements stand for any versions.
A character vector of comparison operators to use for
version. If supplied, must be the same length as
>=is used as default for all elements.
compareare also set to
Optional string indicating why is
pkgneeded. Appears in error messages (if non-interactive) and user prompts (if interactive).
An optional function taking
...arguments. It is called by
check_installed()when the user chooses to update outdated packages. The function is passed the missing and outdated packages as a character vector of names.
The execution environment of a currently running function, e.g.
caller_env(). The function will be mentioned in error messages as the source of the error. See the
abort()for more information.
TRUE if all package names
pkg are installed,
check_installed() either doesn't return or returns
check_installed() signals error conditions of class
rlib_error_package_not_found. The error includes
version fields. They are vectorised and may include several
The error is signalled with a
restart on the stack to allow handlers to install the required
packages. To do so, add a calling handler
rlib_error_package_not_found, install the required packages,
and invoke the restart without arguments. This restarts the check
The condition is not signalled in non-interactive sessions, in the
restarting case, or if the
option is set to