Let's say I have a function that creates x number of objects based on the length of an input variable. I then want those x number of objects to be used as arguments in a function I supply to my function. Assumign that my number of arguments is variable (based on the number of argument names provided), how can I do this?
Can I do this via a string of argument names perhaps?
A non-working example to illustrate what I'm asking:
(in this case, using arguments created outside the function to simplify the example):
foo <- 1:5
na.rm <- T
func <- mean
f1 <- function(func,arg.names) {
func(get(arg.names)) }
f1(func,arg.names = c('foo','na.rm')
How do I do this in a way that get's all arguments from my list?