How do I write a main function flexible enough to pass extra arguments along to multiple functions? Simple attempts have failed:
> mainF <- function(f1,f2,...) {
+ f2( X=f1(...), ... )
+ }
> mainF(function(x) x, function(X, y) X*y, x=5, y=3)
Error in f2(X = f1(...), ...) : unused argument (x = 5)
I can see how this might be possible by examining formals and matching call arguments in the ellipsis to the formals of each function. Is there a better way, though?