Is it possible to remove an element from ... and pass ... onto other functions? My first two attempts failed:
parent = function(...)
{
a = list(...)
Here's an example of how to get the items out of ... and remove an element and then I call the next function with do.call:
parent <- function(...){
funArgs <- list(...)
str(funArgs)
## remove the second item
newArgs <- funArgs[-2]
str(newArgs)
## if you want to call another function, use do.call
do.call(child, newArgs)
}
child = function(...)
{
cat("Don't call me a child, buddy!\n")
a <- list(...)
str(a)
}
parent(a=1, b=2, c=3)
If you need to add more items to your arguments, as opposed to removing arguments, keep in mind that do.call likes named lists where the names are the argument names and the list values are the argument values. It's in the help file, but I struggled with that a bit before finally figuring it out.