autoload {base} | R Documentation |
On-demand Loading of Packages
Description
autoload
creates a promise-to-evaluateautoloader
andstores it with namename
in.AutoloadEnv
environment.WhenR attempts to evaluatename
,autoloader
is run,the package is loaded andname
is re-evaluated in the newpackage's environment. The result is thatR behaves as ifpackage
was loaded but it does not occupy memory.
.Autoloaded
contains the names of the packages forwhich autoloading has been promised.
Usage
autoload(name, package, reset = FALSE, ...)autoloader(name, package, ...).AutoloadEnv.Autoloaded
Arguments
name | string giving the name of an object. |
package | string giving the name of a package containing the object. |
reset | logical: for internal use by |
... | other arguments to |
Value
This function is invoked for its side-effect. It has no return value.
See Also
Examples
require(stats)autoload("interpSpline", "splines")search()ls("Autoloads").Autoloadedx <- sort(stats::rnorm(12))y <- x^2is <- interpSpline(x, y)search() ## now has splinesdetach("package:splines")search()is2 <- interpSpline(x, y+x)search() ## and againdetach("package:splines")
[Packagebase version 4.6.0Index]