rlang (version 0.0.0.9000)

fn_fmls: Extract arguments from a function

Description

fn_defaults() returns a named list of default arguments. fn_fmls_names() returns the names of the arguments.

Usage

fn_fmls(fn = NULL)
fn_fmls_names(fn = NULL)

Arguments

fn
A function. It is lookep up in the calling frame if not supplied.

Details

Contrarily to formals(), these helpers also work with primitive functions. See is_function() for a discussion of primitive and closure functions.

See Also

call_args() and call_args_names()

Examples

Run this code
# Extract from current call:
fn <- function(a = 1, b = 2) fn_fmls()
fn()

# Works with primitive functions:
fn_fmls(base::switch)

Run the code above in your browser using DataCamp Workspace