fn_fmls() returns a named list of formal arguments.
fn_fmls_names() returns the names of the arguments.
fn_fmls_syms() returns formals as a named list of symbols. This
is especially useful for forwarding arguments in constructed calls.
fn_fmls(fn = caller_fn()) fn_fmls_names(fn = caller_fn()) fn_fmls_syms(fn = caller_fn()) fn_fmls(fn) <- value fn_fmls_names(fn) <- value
| fn | A function. It is lookep up in the calling frame if not supplied. |
|---|---|
| value | New formals or formals names for |
Unlike formals(), these helpers throw an error with primitive
functions instead of returning NULL.
# Extract from current call: fn <- function(a = 1, b = 2) fn_fmls() fn()#> $a #> [1] 1 #> #> $b #> [1] 2 #>#> apply(X = X, FUN = FUN, ...)#> $A #> [1] 10 #> #> $B #> [1] 20 #>#> $foo #> [1] 10 #> #> $bar #> [1] 20 #>