EVOLUTION-MANAGER
Edit File: as.environment.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Coerce to an Environment Object</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for as.environment {base}"><tr><td>as.environment {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2> Coerce to an Environment Object </h2> <h3>Description</h3> <p>A generic function coercing an <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> object to an <code><a href="environment.html">environment</a></code>. A number or a character string is converted to the corresponding environment on the search path. </p> <h3>Usage</h3> <pre> as.environment(x) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>an <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> object to convert. If it is already an environment, just return it. If it is a positive number, return the environment corresponding to that position on the search list. If it is <code>-1</code>, the environment it is called from. If it is a character string, match the string to the names on the search list. </p> <p>If it is a list, the equivalent of <code><a href="list2env.html">list2env</a>(x, parent = emptyenv())</code> is returned. </p> <p>If <code><a href="is.object.html">is.object</a>(x)</code> is true and it has a <code><a href="class.html">class</a></code> for which an <code>as.environment</code> method is found, that is used. </p> </td></tr> </table> <h3>Value</h3> <p>The corresponding environment object. </p> <h3>Note</h3> <p>This is a <a href="Primitive.html">primitive</a> function. </p> <h3>Author(s)</h3> <p> John Chambers </p> <h3>See Also</h3> <p><code><a href="environment.html">environment</a></code> for creation and manipulation, <code><a href="search.html">search</a></code>; <code><a href="list2env.html">list2env</a></code>. </p> <h3>Examples</h3> <pre> as.environment(1) ## the global environment identical(globalenv(), as.environment(1)) ## is TRUE try( ## <<- stats need not be attached as.environment("package:stats")) ee <- as.environment(list(a = "A", b = pi, ch = letters[1:8])) ls(ee) # names of objects in ee utils::ls.str(ee) </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>