Learn R Programming

insight (version 0.16.0)

check_if_installed: Checking if needed package is installed

Description

Checking if needed package is installed

Usage

check_if_installed(
  package,
  reason = "for this function to work",
  stop = TRUE,
  minimum_version = NULL,
  quietly = FALSE,
  ...
)

Arguments

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

String, representing the minimum package version that is required. If NULL, no check for minimum version is done. Note that minimum_version only works when package is of length 1.

quietly

Logical, if TRUE, invisibly returns either TRUE if all packages are installed, FALSE otherwise, and does not stop or throw a warning. If quietly = TRUE, argument stop is ignored. Use this argument to internally check for package dependencies without stopping or warnings.

...

Currently ignored

Value

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.

Examples

Run this code
# NOT RUN {
check_if_installed("inexistent_package")
check_if_installed("insight")
check_if_installed("insight", minimum_version = "99.8.7")

x <- check_if_installed(c("inexistent", "also_not_here"), stop = FALSE)
x
# }

Run the code above in your browser using DataLab