A silly example to illustrate variable numbers of arguments. The
... get put in a list and written out to the screen. Then those same
arguments are passed to the plot function.
function(x, y, ...)
{
opt.arg.list <- list(...)
i <- 1
for(arg in opt.arg.list) {
cat(paste("Arg", i, " = ", "'", arg, "'", "\n", sep = ""))
i <- i + 1
}
plot(x, y, ...)
}
Other places to look:
-
Within Splus: help(syntax)
-
See page 95 of Venables & Ripley