Utility functions to access and replace the non-exported functions in a namespace, for use in developing packages with namespaces.
They should not be used in production code (except perhaps
assignInMyNamespace, but see the ‘Note’).
1 2 3 4 5 6 7 8
an object name (given as a character string).
an R object.
a namespace, or character string giving the namespace.
where to look for the object: see
an alternative way to specify an environment to look in.
arguments to pass to the editor: see
assignInMyNamespace is intended to be called from functions
within a package, and chooses the namespace as the environment of the
function calling it.
The namespace can be specified in several ways. Using, for example,
ns = "stats" is the most direct, but a loaded package can be
specified via any of the methods used for
can also be the environment printed as
getFromNamespace is similar to (but predates) the
::: operator: it is more flexible in how the namespace
edit on the object named
x and assigns the revised object in place of the original
object. For compatibility with
x can be unquoted.
getFromNamespace returns the object found (or gives an error).
fixInNamespace are invoked for their side effect of changing
the object in the namespace.
assignInNamespace should not be used in final code, and will in
future throw an error if called from a package. Already certain uses
fixInNamespace change the copy in the namespace, but not any
copies already exported from the namespace, in particular an object of
that name in the package (if already attached) and any copies already
imported into other namespaces. They are really intended to be used
only for objects which are not exported from the namespace.
They do attempt to alter a copy registered as an S3 method if one is
They can only be used to change the values of objects in the namespace, not to create new objects.
1 2 3 4 5 6 7 8 9 10
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.