\Header{as.environment}{Coerce to an Environment Object}
\keyword{data}{as.environment}
\keyword{environment}{as.environment}
\begin{Description}\relax
Converts a number or a character string to the corresponding
environment on the search path.
\end{Description}
\begin{Usage}
\begin{verbatim}
as.environment(object)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] the object to convert.  If it is already an
environment, just return it.  If it is a number, return the
environment corresponding to that position on the search list.  If
it is a character string, match the string to the names on the
search list.
\end{ldescription}
\end{Arguments}
\begin{Value}
The corresponding environment object.
\end{Value}
\begin{Author}\relax
John Chambers
\end{Author}
\begin{SeeAlso}\relax
\code{\Link{environment}} for creation and manipulation,
\code{\Link{search}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
as.environment(1) ## the global environment
identical(globalenv(), as.environment(1)) ## is TRUE
try(as.environment("package:stats"))      ## stats need not be loaded
\end{ExampleCode}
\end{Examples}

