Description Usage Arguments Examples
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 and S3 methods table) 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 mvbutils:::.onLoad
.
Note that, if you call assign.to.base
during the .onLoad
of your package, then it must be called directly from the .onLoad
, not via an intermediate function; otherwise, it won't correctly reset its argument in the import-environment of your namespace. To get round this, wrap it in an mlocal
; see mvbutils:::.onLoad
for an example.
assign.to.base
is only meant for changing things in packages, e.g. not for things that merely sit in non-package environments high on the search path (where <<-
should work). I don't know how it will behave if you try. It won't work for S4 methods, either.
1 2 | hack( fun, ...)
assign.to.base( x, what=, where=-1, in.imports=, override.env = TRUE)
|
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 |
where |
where to find the replacement function, defaulting to usual search path |
in.imports |
usually TRUE, if this is being called from an |
override.env |
should the replacement use its own environment, or (by default) the one that was originally there? |
1 2 3 4 5 |
Attaching package: 'mvbutils'
The following object is masked from 'package:graphics':
clip
The following objects are masked from 'package:utils':
?, help
The following objects are masked from 'package:base':
print.default, print.function, rbind, rbind.data.frame
function (path = ".", pattern = NULL, all.files = getOption("ls.all.files",
TRUE), full.names = FALSE, recursive = FALSE, ignore.case = FALSE,
include.dirs = FALSE, no.. = FALSE)
.Internal(list.files(path, pattern, all.files, full.names, recursive,
ignore.case, include.dirs, no..))
<environment: namespace:base>
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.