getDefault | R Documentation |
Get the default value that is defined for a function's argument
getDefault(funName, argName, default = NULL, warn = TRUE)
funName |
Name of the function |
argName |
Name of the formal argument |
default |
Default value to use if no default value is stored for
argument |
warn |
if |
default value that is defined for the formal argument argName
of the user-defined function funName
setDefault
# Once you have defined a function... hello <- function(firstName = getDefault("hello", "firstName")) { cat("Hello", firstName, "\n") } # ... you can define the default value for its arguments... setDefault("hello", firstName = "Peter") # ... and read it back with getDefault()... getDefault("hello", "firstName")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.