Skip to content
Prev 75844 / 398502 Next

problem with repeated formal arguments and ...

Ross Boylan wrote:
Hi, Ross,

Add "from" to your function:

test <- function(x, from = 0, ...) {
   curve(x, from = from, ...)
}

Or another way:

test <- function(x, ...) {
   dots <- list(...)
   if(!hasArg(from)) dots$from <- 0
   dots$expr <- x
   do.call("curve", dots)
}

I actually prefer the latter if I'm changing many arguments. I do this 
quite often when writing custom lattice plots and I want to override 
many of the defaults.

HTH,

--sundar