use
From R.utils v1.28.4
by Henrik Bengtsson
Attaches or loads packages
Attaches or loads packages. If a package is not installed, it will be installed from one of the repositories.
- Keywords
- internal, utilities, programming
Usage
## S3 method for class 'default':
use(pkg, version=NULL, how=c("attach", "load"), quietly=TRUE, warn.conflicts=!quietly,
install=TRUE, repos=NULL, ..., verbose=FALSE)
Arguments
- pkg
- A
character
vector
specifying the package(s) to be used. - version
- (optional) Version constraint(s) on requested package(s).
- how
- A
character
string specifying whether the package should be attached or loaded. - quietly
- If
TRUE
, minimial or no messages are reported. - warn.conflicts
- If
TRUE
, warnings on namespace conflicts are reported, otherwise not. - install
- If
TRUE
and the package is not installed or an too old version is installed, then tries to install a newer version, otherwise not. - repos
- (optional) A
character
vector
specifying where to install the package from if not already installed. - ...
- Additional named arguments passed to
require
() orrequireNamespace
(). - verbose
- If
TRUE
, verbose output is generated (regardless ofquietly
).
Value
- Returns a
vector
ofpackage_version
() for each package attached/loaded. If one of the requested packages/package versions is not available and could not be installed, an error is thrown.
See Also
library
() and "base::install.packages".
Examples
use("digest")
use("digest (>= 0.6.3)")
use("digest (>= 0.6.3)", repos=c("CRAN", "R-Forge"))
use("(CRAN|R-Forge)::digest (>= 0.6.3)")
use("digest, R.rsp (>= 0.9.17)")
Community examples
Looks like there are no examples yet.