Description Usage Arguments Details Value Examples
default()
lets you check, and change, a function's
default arguments. reset_default()
returns the arguments to their
original defaults.
1 2 3 4 5 | default(fun)
default(fun) <- value
reset_default(fun)
|
fun |
a function |
value |
a named list of new default arguments for that function |
If fun
is a function from a package, a function of the same
name will be defined in the calling environment (e.g. your workspace).
If fun
is defined locally, it will be overwritten by the version
with the new defaults.
reset_default
returns the reset function, rather than
modifying it in place, so you'll need to reassign it, as in the example.
default()
(without assignment) invisibly returns a pairlist of
the current values of the default arguments. It also prints the default
arguments, highlighting those that the user has changed from their original
defaults.
reset_default()
returns the fun
, but with the defaults reset
to their original values. If fun
was a function from a package, the
same thing can be achieved by replacing the locally-defined version of the
function.
1 2 3 4 5 6 7 8 9 10 | # list the default arguments for a function
default(data.frame)
# change one or more of them
default(data.frame) <- list(fix.empty.names = FALSE)
data.frame(1:3)
# reset the defaults
data.frame <- reset_default(data.frame)
data.frame(1:3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.