EVOLUTION-MANAGER
Edit File: getPackageName.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: The Name associated with a Given Package</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 getPackageName {methods}"><tr><td>getPackageName {methods}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>The Name associated with a Given Package</h2> <h3>Description</h3> <p>The functions below produce the package associated with a particular environment or position on the search list, or of the package containing a particular function. They are primarily used to support computations that need to differentiate objects on multiple packages. </p> <h3>Usage</h3> <pre> getPackageName(where, create = TRUE) setPackageName(pkg, env) packageSlot(object) packageSlot(object) <- value </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>where</code></td> <td> <p>the environment or position on the search list associated with the desired package.</p> </td></tr> <tr valign="top"><td><code>object</code></td> <td> <p>object providing a character string name, plus the package in which this object is to be found.</p> </td></tr> <tr valign="top"><td><code>value</code></td> <td> <p>the name of the package.</p> </td></tr> <tr valign="top"><td><code>create</code></td> <td> <p>flag, should a package name be created if none can be inferred? If <code>TRUE</code> and no non-empty package name is found, the current date and time are used as a package name, and a warning is issued. The created name is stored in the environment if that environment is not locked.</p> </td></tr> <tr valign="top"><td><code>pkg, env</code></td> <td> <p>make the string in <code>pkg</code> the internal package name for all computations that set class and method definitions in environment <code>env</code>.</p> </td></tr> </table> <h3>Details</h3> <p>Package names are normally installed during loading of the package, by the <a href="../../utils/html/INSTALL.html">INSTALL</a> script or by the <code><a href="../../base/html/library.html">library</a></code> function. (Currently, the name is stored as the object <code>.packageName</code> but don't trust this for the future.) </p> <h3>Value</h3> <p><code>getPackageName</code> returns the character-string name of the package (without the extraneous <code>"package:"</code> found in the search list). </p> <p><code>packageSlot</code> returns or sets the package name slot (currently an attribute, not a formal slot, but this may change someday). </p> <p><code>setPackageName</code> can be used to establish a package name in an environment that would otherwise not have one. This allows you to create classes and/or methods in an arbitrary environment, but it is usually preferable to create packages by the standard <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> programming tools (<code><a href="../../utils/html/package.skeleton.html">package.skeleton</a></code>, etc.) </p> <h3>See Also</h3> <p><code><a href="../../base/html/search.html">search</a></code>, <code><a href="../../utils/html/packageName.html">packageName</a></code> </p> <h3>Examples</h3> <pre> ## all the following usually return "base" getPackageName(length(search())) getPackageName(baseenv()) getPackageName(asNamespace("base")) getPackageName("package:base") </pre> <hr /><div style="text-align: center;">[Package <em>methods</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>