Collects all function arguments other than the first into a single list parameter.
collect_fn_params.Rd
Useful for converting a regular function into a function amenable to
optimization via stats::optim
, which requires all free parameters be
passed as a single vector par
.
Arguments
- fn
function
A non-primitive function to refactor such that the first argument becomes the second argument and all other parameters must be passed as a vector to the first argument of the new function via thepar
parameter.