defining default values in ellipsis of an existing function with formals

I want to modify an existing function (from a package) that uses ... (aka, triple-dots, dot-dot-dot, ellipsis). I thought of using formals. To make it concrete let's say that the function looks like this:

test <- function(x,...){
    print(x)
    print(list(...))
}

How do I add an argument w=1 that should go to the ellipsis and ideally could be overwritten by the user:
This doesn't work:

formals(test)$w <- 1

I would image that it should look like this, but it also doesn't work:

formals(test)$... <- list(w=3, formals(test)$...)

Any ideas?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.