getFromNamespace
Utility functions for Developing Namespaces
Description
Gets an object from a namespace, assigns the value of an object to a namespace, or
changes the value of an object in a namespace.
Usage
assignInNamespace(x, value, ns, pos = -1, envir = as.environment(pos))
assignInMyNamespace(x, value)
getFromNamespace(x, ns, pos = -1, envir = as.environment(pos))
Arguments
x |
a character string giving the name of the object. Must be non-empty string.
|
value |
the value to be assigned to the object x.
|
ns |
a character string giving the name of a namespace, or a
namespace environment.
|
pos |
an integer, a character string, or an environment specifying
in which environment to find the object.
|
envir |
an environment object. An alternative way to specify in which
environment to find the object. The default value is specified
by pos.
|
... |
other optional arguments passed to edit function.
|
Details
getFromNamespace is used to get an unexported object from
a namespace. It is more like the ::: operator but the namespace
can be specified in more ways.
assignInNamespace is used to assign a new value to an unexported
object from a namespace. assignInMyNamespace is called inside of
a package, therefore the namespace of calling function is used as environment
to assign new value to the object.
Value
getFromNamespace | returns the value of the found object. |
assignInNamespace | returns NULL. |
assignInMyNamespace | returns NULL. |
See Also
Examples
getFromNamespace("print.hclust", ns = "stats")
getFromNamespace("print.hclust", pos = "package:stats")
stats:::print.hclust