Checks if a package is installed and informs the user if not
Source:R/dependencies.R
      is_installed2.RdThis is wrapper around rlang::check_installed;
instead of erroring out if the check fails it returns FALSE.
However, unlike rlang::is_installed, it emits a message to the user.
Arguments
- ...
 Arguments passed on to
rlang::check_installedpkgThe package names. Can include version requirements, e.g.
"pkg (>= 1.0.0)".versionMinimum versions for
pkg. If supplied, must be the same length aspkg.NAelements stand for any versions.compareA character vector of comparison operators to use for
version. If supplied, must be the same length asversion. IfNULL,>=is used as default for all elements.NAelements incompareare also set to>=by default.reasonOptional string indicating why is
pkgneeded. Appears in error messages (if non-interactive) and user prompts (if interactive).actionAn optional function taking
pkgand...arguments. It is called bycheck_installed()when the user chooses to update outdated packages. The function is passed the missing and outdated packages as a character vector of names.callThe 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 thecallargument ofabort()for more information.
See also
Other dependencies helper:
pkg_installed,
pkg_installed_but_not_via_loadall
Examples
rlang::with_interactive(is_installed2("idonotexist"), FALSE)
#> The optional package "idonotexist" is missing..
#> This message is displayed once per session.
#> [1] FALSE
rlang::with_interactive(is_installed2("base"), FALSE)
#> [1] TRUE