[R] Variable number of arguments to function

From: Michael Prager <Mike.Prager_at_noaa.gov>
Date: Fri 26 May 2006 - 03:07:46 EST

Dear R List,

I have used ... to pass a varying number of arguments to a function. The function takes parts of specialized data objects (they happen to be lists) and makes comparative graphs and analyses. The code shell looks like this:

models.compare <- function(...) {

## Get the data objects passed

   models <- list(...)
   nmodels <- length(models)
## Get names of models:

   modelnames <- as.character(substitute(c(...))[-1])    ##### much code omitted here #####

Now I would like to pass a few named arguments to the function as well, to control how it prints, plots, makes files. I am seeking advice on the simplest way to do this (along with the varying number of data arguments).


Michael H. Prager
Population Dynamics Team
NOAA Center for Coastal Habitat and Fisheries Research
Beaufort, North Carolina 28516 USA

R-help@stat.math.ethz.ch mailing list
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Fri May 26 03:15:00 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 26 May 2006 - 04:10:22 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.