Skip to content
Prev 75848 / 398503 Next

problem with repeated formal arguments and ...

Sundar Dorai-Raj wrote:
I didn't check this example, but for curve, since `x' is an expression, 
we should actually do the following:

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

test(x^3 - 3 * x, to = 5)
test(x^3 - 3 * x, from = -5, to = 5)


HTH,

--sundar