\HeaderA{load}{Reload Saved Datasets}{load}
\aliasA{loadURL}{load}{loadURL}
\keyword{file}{load}
\begin{Description}\relax
Reload datasets written with the function \code{save}.
\end{Description}
\begin{Usage}
\begin{verbatim}
load(file, envir = parent.frame())
loadURL(url, envir = parent.frame(), quiet = TRUE, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{file}] a connection or a character string giving the name of the
file to load.
\item[\code{envir}] the environment where the data should be loaded.
\item[\code{url}] a character string naming a URL.
\item[\code{quiet, ...}] additional arguments to
\code{\LinkA{download.file}{download.file}}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{load} can load \R{} objects saved in the current or any earlier
format.  It can read a compressed file (see \code{\LinkA{save}{save}})
directly from a file or from a suitable connection (including a call
to \code{\LinkA{url}{url}}).

\code{loadURL} is a convenience wrapper which downloads a file, loads
it and deletes the downloaded copy.

Only \R{} objects saved in the current format (used since \R{} 1.4.0)
can be read from a connection.  If no input is available on a
connection a warning will be given, but any input not in the current
format will result in a error.
\end{Details}
\begin{Value}
A character vector of the names of objects created, invisibly.
\end{Value}
\begin{Section}{Warning}
Saved \R{} objects are binary files, even those saved with
\code{ascii = TRUE}, so ensure that they are transferred without
conversion of end of line markers.  \code{load} tries to detect this
case and give an informative error message.
\end{Section}
\begin{SeeAlso}\relax
\code{\LinkA{save}{save}}, \code{\LinkA{download.file}{download.file}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## save all data
save(list = ls(all=TRUE), file= "all.Rdata")

## restore the saved values to the current environment
load("all.Rdata")

## restore the saved values to the user's workspace
load("all.Rdata", .GlobalEnv)

## Not run: 
## print the value to see what objects were created.
print(loadURL("http://some.where.net/R/data/kprats.rda"))
# or, avoiding making a local copy,
print(load(url("http://some.where.net/R/data/kprats.rda")))
## End(Not run)\end{ExampleCode}
\end{Examples}

