Skip to contents

Match a functions arguments.

Usage

match_args(f, args)

Arguments

f

The parsnip function such as "linear_reg" as a string and without the parentheses.

args

The arguments you want to supply to f

Value

A list of matched arguments.

Details

Match a functions arguments, the bad ones passed will be rejected but the remaining passing ones will be returned.

Author

Steven P. Sanderson II, MPH

Examples


match_args(
  f = "linear_reg",
  args = list(
    mode = "regression",
    engine = "lm",
    trees = 1,
    mtry = 1
   )
 )
#> bad arguments passed: trees
#> bad arguments passed: mtry
#> $mode
#> [1] "regression"
#> 
#> $engine
#> [1] "lm"
#>