Reputation: 5464
Let us saw we have a function defined as:
foobar(string.argument, ...)
let us say we have a list
my.list <- list("a", "b", "c", "d")
how can we invoke foobar equivalent to:
foobar("some value", "a", "b", "c", "d")
of course using my.list for the variable parameter list.
Upvotes: 0
Views: 24
Reputation: 37879
do.call
would probably help you do what you want:
my.list <- list("a", "b", "c", "d")
#add 'some value' to my.list
my.list <- c('some value', my.list)
do.call(foobar, my.list)
do.call
will run foobar having as arguments the elements in my.list.
Upvotes: 2