Skip to contents

This function takes another function as input and prints its arguments in the format ArgumentName = DefaultValue. Each argument is printed on a new line. The function can optionally assign the formatted arguments to the global environment and can load a specified package before processing.

Usage

CatFunArgs(Function, Assign = FALSE, Package = NULL)

Arguments

Function

A function whose arguments you want to print. Must be a valid R function.

Assign

Logical. Whether to assign the arguments as variables in the global environment. Defaults to FALSE.

Package

Character string. The name of the R package to be loaded before processing the function. Default is NULL.

Value

The function prints the formatted arguments to the console. If Assign is TRUE, it also assigns arguments to the global environment.

Author

Ahmed El-Gabbas

Examples

formals(stats::setNames)
#> $object
#> nm
#> 
#> $nm
#> 
#> 
CatFunArgs(stats::setNames)
#> object = NULL
#> nm = NULL