Skip to content
Prev 170325 / 398506 Next

Messing with the "..." argument

here's an example which may give you a hint -- it is not supposed to
solve your particular problem:

f = function(...)
    list(...)
g = function(...) {
    args = list(...)
    names = names(args)
    if (is.null(names))
       f(...)
    else
        do.call(f, args[names(args) != 'foo']) }

g()
# list()
g(1)
# list(1)
g(a=1)
# list(a=1)
g(a=1, foo=2)
# list(a=1)
g(1, foo=2)
# list(1)
g(foo=1)
# list()

consider using grep for finding the variables to be removed.

vQ
Steve Lianoglou wrote: