qwraps2 (version 0.4.2)

pkg_check: Package Checks

Description

Check if a package is available on the local machine and optionally verify a version.

Usage

pkg_check(pkgs, versions, stop = FALSE)

Arguments

pkgs

a character vector of package names to check for

versions

an optional character vector, of the same length of pkgs for the minimum version of the packages.

stop

if TRUE then an error is thrown if any of the checks fail. If FALSE (default) a logical is returned.

Details

When writing a script that will be shared it is very likely that the multiple authors/users will need to have a certain set of packages available to load. The pkg_check function will verify that the packages are available to load, this includes an optional version test, and attach the package to the search list if requested.

Testing for package versions will is done as packageVersion(x) >= version. If you need a specific version of a package you should explicitly use packageVersion(x) == version in your script.