hack {mvbutils} | R Documentation |
Modify standard R functions, including tweaking their default arguments
Description
You probably shouldn't use these... hack
lets you easily change the argument defaults of a function. assign.to.base
replaces a function in base
or utils
(or any other package and its namespace) with a modified version, possibly produced by hack
. Package mvbutils uses these two to change the default position for library attachment, etc; see the code of .First.lib
.
Usage
hack( fun, ...)
assign.to.base( x, what=, where=-1, in.imports=, override.env = TRUE)
Arguments
fun |
a function (not a character string) |
... |
pairlist of arguments and new default values, e.g. arg1=1+2. Things on RHS of equal signs will not be evaluated. |
x |
function name (a character string) |
what |
function to replace x , defaulting to "replacement." %&% x |
where |
where to find the replacement function, defaulting to usual search path |
in.imports |
usually TRUE, if this is being called from an .onLoad method in a namespace. Make sure any copies of the function to be changed that are in the "imports" namespace also get changed. |
override.env |
should the replacement use its own environment, or the one that was originally there? |
Examples
## Not run:
hack( dir, all.files=option.or.default( "ls.all.files", TRUE)) # from '.First.lib' in 'mvbutils'
assign.to.base( "dir", hack( dir, all.files=TRUE))
## End(Not run)
[Package
mvbutils version 2.5.0
Index]