autoload {base} | R Documentation

## On-demand Loading of Packages

### Description

`autoload` creates a promise-to-evaluate `autoloader` and stores it with name `name` in `.AutoloadEnv` environment. When R attempts to evaluate `name`, `autoloader` is run, the package is loaded and `name` is re-evaluated in the new package's environment. The result is that R behaves as if `file` was loaded but it does not occupy memory.

### Usage

    autoload(name, package, ...)
    autoloader(name, package, ...)
    .AutoloadEnv

### Arguments

`name` | string giving the name of an object.
`package` | string giving the name of a package containing the object.
`...` | other arguments to `library`.

### Value

This function is invoked for its side-effect. It has no return value as of R 1.7.0.

### See Also

`delay`, `library`

### Examples

    autoload("line","eda")
    search()
    ls("Autoloads")

    data(cars)
    plot(cars)
    z<-line(cars)
    abline(coef(z))
    search()
    detach("package:eda")
    search()
    z<-line(cars)
    search()

[Package Contents]