| rk.replace.function {rkward} | R Documentation |
rk.replace.function can be used to replace a
function inside a different package / namespace. It is
mainly intended for internal usage inside rkward, e.g. to
replace menu and select.list with
appropriate GUI implementations.
rk.replace.function(functionname, environment,
replacement, copy.formals = TRUE)
functionname |
name of the function to be replaced (character). |
environment |
package environment or namespace, where replacment should be done. |
replacement |
the replacement. This should be a function. |
copy.formals |
logical; whether to copy the
|
The original function is assigned to the environment
rkward::.rk.backups with the same name as the
original, and can be referred to from the replacement.
WARNING: This mechanism does not support several
subsequent replacments of the same function, nor does it
support replacement of generics.
WARNING: This function can be used to alter - and disrupt - internal functions in arbitrary ways. You better know what you are doing.
WARNING: Does not work well on generics!
Returns NULL, invisibly, unconditionally.
Thomas Friedrichsmeier rkward-devel@lists.sourceforge.net
## Not run
rk.replace.function ("history", as.environment ("package:utils"),
function () {
cat ("This is what you typed:\n")
eval (body (.rk.backups$history))
})
## End not run