Best way for a function to accept alternative inputs

Hello!
I was wondering which is the best way to implement a function that accept two types of inputs. Let's say I have the function:

foo <- function(param1, param2, param3){}

but also would like to pass those same params via config file (say a yaml file) for convenience:

foo <- function(file) {}

Thanks!

Xavi.

My approach with this functionality would be to define foo. Then define a different function, perhaps foo_from_file that reads the file and calls foo in turn.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.