Learn R Programming

installr (version 0.15.3)

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 = TRUE, ...)

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 TRUE)
...
not used

Value

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

Examples

Run this code
a= require2("devtools")
a
a= require2(geonames)
a

Run the code above in your browser using DataLab