Skip to content
Prev 75841 / 398502 Next

problem with repeated formal arguments and ...

I want to add an argument if it is not present.  Following the Green
Book, p. 337:
test <- function(x, ...){
  dots <- list(...)
  if (!hasArg(from))
    from <- 0
  else
    from <- dots$from
  curve(x, from=from, ...)
}
Error in curve(x, from = from, ...) : formal argument "from" matched by
multiple actual arguments

The FAQ says, in the section on differences between R and S,
"R disallows repeated formal arguments in function calls."

That seems a perfectly reasonable rule,  but how do I handle this
situation?