EVOLUTION-MANAGER
Edit File: ns-topenv.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: Top Level Environment</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 ns-topenv {base}"><tr><td>ns-topenv {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Top Level Environment</h2> <h3>Description</h3> <p>Finding the top level <code><a href="environment.html">environment</a></code> from an environment <code>envir</code> and its enclosing environments. </p> <h3>Usage</h3> <pre> topenv(envir = parent.frame(), matchThisEnv = getOption("topLevelEnvironment")) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>envir</code></td> <td> <p>environment.</p> </td></tr> <tr valign="top"><td><code>matchThisEnv</code></td> <td> <p>return this environment, if it matches before any other criterion is satisfied. The default, the option <span class="samp">topLevelEnvironment</span>, is set by <code><a href="sys.source.html">sys.source</a></code>, which treats a specific environment as the top level environment. Supplying the argument as <code>NULL</code> means it will never match.</p> </td></tr> </table> <h3>Details</h3> <p><code>topenv</code> returns the first top level <code><a href="environment.html">environment</a></code> found when searching <code>envir</code> and its enclosing environments. An environment is considered top level if it is the internal environment of a namespace, a package environment in the <code><a href="search.html">search</a></code> path, or <code><a href="environment.html">.GlobalEnv</a></code> . </p> <h3>See Also</h3> <p><code><a href="environment.html">environment</a></code>, notably <code>parent.env()</code> on “enclosing environments”; <code><a href="ns-load.html">loadNamespace</a></code> for more on namespaces. </p> <h3>Examples</h3> <pre> topenv(.GlobalEnv) topenv(new.env()) # also global env topenv(environment(ls))# namespace:base topenv(environment(lm))# namespace:stats </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>