Learn R Programming

pi0 (version 1.3-250)

loadOrInstall: Load packages or install and load packages

Description

This functino loads packages if they are installed already. If failed, it tries to install the package automatically and re-load the package after installation.

Usage

loadOrInstall(package, dependencies="Depends",...)

Arguments

package
A character vector of the names of packages to be loaded.
dependencies
The same as in install.packages.
...
Additional arguments passed to require, install.packages.

Value

  • A logical scalar. TRUE if all packages are loaded sucessfully. If FALSE, its "failed" attribute contains a vector of package names that failed to be loaded.

Details

The function calls require to see if the package can be loaded. If not, it calls install.packages. Then require is called again for the installed package.

See Also

library, require, install.packages