getDefault: Get the default value that is defined for a function's...

View source: R/default_main.R

getDefaultR Documentation

Get the default value that is defined for a function's argument

Description

Get the default value that is defined for a function's argument

Usage

getDefault(funName, argName, default = NULL, warn = TRUE)

Arguments

funName

Name of the function

argName

Name of the formal argument

default

Default value to use if no default value is stored for argument argName of function funName

warn

if TRUE (default) a message is given if no defaults are defined for the given function or argument and if default is returned instead.

Value

default value that is defined for the formal argument argName of the user-defined function funName

See Also

setDefault

Examples

# 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")

KWB-R/kwb.default documentation built on June 17, 2022, 3:04 a.m.