View source: R/check_if_installed.R
check_if_installed | R Documentation |
Checking if needed package is installed
check_if_installed(
package,
reason = "for this function to work",
stop = TRUE,
minimum_version = NULL,
quietly = FALSE,
prompt = interactive(),
...
)
package |
A character vector naming the package(s), whose installation needs to be checked in any of the libraries. |
reason |
A phrase describing why the package is needed. The default is a generic description. |
stop |
Logical that decides whether the function should stop if the needed package is not installed. |
minimum_version |
A character vector, representing the minimum package
version that is required for each package. Should be of same length as
|
quietly |
Logical, if |
prompt |
If |
... |
Currently ignored |
If stop = TRUE
, and package
is not yet installed, the
function stops and throws an error. Else, a named logical vector is
returned, indicating which of the packages are installed, and which not.
check_if_installed("insight")
try(check_if_installed("datawizard", stop = FALSE))
try(check_if_installed("rstanarm", stop = FALSE))
try(check_if_installed("nonexistent_package", stop = FALSE))
try(check_if_installed("insight", minimum_version = "99.8.7"))
try(check_if_installed(c("nonexistent", "also_not_here"), stop = FALSE))
try(check_if_installed(c("datawizard", "rstanarm"), stop = FALSE))
try(check_if_installed(c("datawizard", "rstanarm"),
minimum_version = c(NA, "2.21.1"), stop = FALSE
))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.