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.
getPackageName(where, create = TRUE) setPackageName(pkg, env) packageSlot(object) packageSlot(object) <- value
the environment or position on the search list associated with the desired package.
object providing a character string name, plus the package in which this object is to be found.
the name of the package.
flag, should a package name be created if none can be
make the string in
Package names are normally installed during loading of the package,
by the INSTALL script or by the
function. (Currently, the name is stored as the object
.packageName but don't trust this for the future.)
getPackageName returns the character-string name of the package
(without the extraneous
"package:" found in the search list).
packageSlot returns or sets the package name slot (currently
an attribute, not a formal slot, but this may change someday).
setPackageName 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 R programming tools (
## all the following usually return "base" getPackageName(length(search())) getPackageName(baseenv()) getPackageName(asNamespace("base")) getPackageName("package:base")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.