Learn R Programming

installr (version 0.22.0)

require2: Loading Packages (and Installing them if they are missing)

Description

require2 load add-on packages by passing it to require. However, if the package is not available on the system, it will first install it (through install.packages), and only then try to load it again.

Usage

require2(package, ask = FALSE, character.only = FALSE, ...)

Arguments

package

A character of the name of a package (can also be without quotes).

ask

Should the user be asked to install the require packaged, in case it is missing? (default is FALSE)

character.only

logical (FALSE) - a logical indicating whether package or help can be assumed to be character strings. Passed to require.

...

not used

Value

returns (invisibly) a logical indicating whether the required package is available.

Examples

Run this code
# NOT RUN {
a= require2("devtools")
a
a= require2(geonames)
a
# }

Run the code above in your browser using DataLab