\Header{autoload}{On-demand loading of packages}
\alias{autoloader}{autoload}
\alias{.AutoloadEnv}{autoload}
\keyword{data}{autoload}
\keyword{programming}{autoload}
\begin{Usage}
\begin{verbatim}
autoload(name, file)
autoloader(name, file)
.AutoloadEnv
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\texttt{name}] string giving the name of an object
\item[\texttt{file}] string giving the name of a package containing the object
\end{ldescription}
\end{Arguments}
\begin{Description}
\texttt{autoload} creates a promise-to-evaluate \texttt{autoloader} and stores it with name \texttt{name} in
\texttt{.AutoloadEnv} environment.  When \R\ attempts to evaluate
\texttt{name}, \texttt{autoloader} is run,
the package is loaded and \texttt{name} is re-evaluated in the
new package's environment.  The result is that \R\ behaves as if
\texttt{file} was loaded but it does not occupy memory.\end{Description}
\begin{Value}
see description\end{Value}
\begin{SeeAlso}
\texttt{\Link{delay}}, \texttt{\Link{library}}\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
autoload("line","eda")
search()
ls("Autoloads")
all(ls("Autoloads") == ls(envir = .AutoloadEnv))
data(cars)
plot(cars)
z<-line(cars)
abline(coef(z))
search()
detach("package:eda")
search()
z<-line(cars)
search()
\end{ExampleCode}
\end{Examples}

