Learn R Programming

BBmisc (version 1.9)

requirePackages: Require some packages.

Description

Packages are loaded either via requireNamespace or require.

If some packages could not be loaded and stop is TRUE the following exception is thrown: “For please install the following packages: ”. If why is NULL the message is: “Please install the following packages: ”.

Usage

requirePackages(packs, why = "", stop = TRUE, suppress.warnings = FALSE, default.method = "attach")

Arguments

packs
[character] Names of packages. If a package name is prefixed with “!”, it will be attached using require. If a package name is prefixed with “_”, its namespace will be loaded using requireNamespace. If there is no prefix, argument default.method determines how to deal with package loading.
why
[character(1)] Short string explaining why packages are required. Default is an empty string.
stop
[logical(1)] Should an exception be thrown for missing packages? Default is TRUE.
suppress.warnings
[logical(1)] Should warnings be supressed while requiring? Default is FALSE.
default.method
[character(1)] If the packages are not explicitly prefixed with “!” or “_”, this arguments determines the default. Possible values are “attach” and “load”. Note that the default is “attach”, but this might/will change in a future version, so please make sure to always explicitly set this.

Value

[logical]. Named logical vector describing which packages could be loaded. Same length as packs.

Examples

Run this code
requirePackages(c("BBmisc", "base"), why = "BBmisc example")

Run the code above in your browser using DataLab