getFromNamespace {base} | R Documentation |
Utility functions to access and replace the non-exported functions in a namespace, for use in developing packages with namespaces.
getFromNamespace(x, ns, pos = -1, envir = as.environment(pos)) fixInNamespace(x, ns, pos = -1, envir = as.environment(pos), ...)
x |
an object name (given as a character string). |
ns |
a namespace, or character string giving the namespace. |
pos |
where to look for the object: see get . |
envir |
an alternative way to specify an environment to look in. |
... |
arguments to pass to the editor: see edit . |
The namespace can be specified in several ways. Using, for example,
ns="modreg"
is the most direct, but a loaded package with a
namespace can be specified via any of the methods used for
get
: ns
can also be the environment
<namespace:foo>
.
fixInNamespace
invokes edit
on the object named
x
and assigns the revised object in place of the original
object. For compatibility with fix
, x
can be unquoted.
getFromNamespace
returns the object found (or gives an error).
fixInNamespace
is invoked for its side effect of changing the
object in the namespace.
fixInNamespace
will alter the copy of the object in the
namespace, and also a copy registered as an S3 method. There can be other
copies, so the function is not foolproof, but should be helpful for
debugging.
## Not run: fixInNamespace("predict.ppr", "modreg") ## alternatively fixInNamespace("predict.ppr", pos = 5) ## End(Not run)