Thanks to those who responded. I finally got by with some pretty ugly hack (ceorcing ... to list, delete the unwanted part, add other arguments, and use do.call).
Cheers, Andy > -----Original Message----- > From: Ben Bolker [mailto:[EMAIL PROTECTED] > Sent: Friday, March 21, 2003 3:59 PM > To: Liaw, Andy > Cc: '[EMAIL PROTECTED]' > Subject: Re: [R] manipulating "..." inside a function > > > > I have a couple of slightly ugly functions to do this in my bbmisc > package: > > clean.args <- function(argstr,fn,extrabad=NULL,dots.ok=TRUE) { > fnargs <- names(formals(fn)) > if (length(argstr)>0 && !("..." %in% fnargs && dots.ok)) { > badargs <- !sapply(names(argstr),"%in%",c(fnargs,"")) > argstr <- argstr[!badargs] > } > for (i in extrabad) > argstr[[i]] <- NULL > argstr > } > > remove.args <- function(argstr,fn) { > fnargs <- names(formals(fn)) > argstr[!(names(argstr) %in% fnargs)] > } > > > On Fri, 21 Mar 2003, Liaw, Andy wrote: > > > Dear R-help, > > > > Can some one tell me how to do the following (if it's possible)? > > > > Suppose I have a function like this: > > > > f <- function(x, y, ...) { > > ## some code > > g(x, y, ...) > > ## some more code > > } > > > > The problem is that g() may not understand everything that > comes through in > > "...". Is there a way to delete some component of "..." > and then pass it to > > g()? > > > > Here's the description of the real problem: f() is a > panel.something > > function, and g() is a model fitting function. Lattice passes > > "panel.number" as part of "..." to f(), and g() complains > about unused > > argument "panel.number". > > > > I'd be very grateful for any help! > > > > Cheers, > > Andy > > > > > > > -------------------------------------------------------------- > ---------------- > > > > ______________________________________________ > > [EMAIL PROTECTED] mailing list > > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > > > > -- > 318 Carr Hall [EMAIL PROTECTED] > Zoology Department, University of Florida > http://www.zoo.ufl.edu/bolker > Box 118525 (ph) 352-392-5697 > Gainesville, FL 32611-8525 (fax) 352-392-3704 > > ------------------------------------------------------------------------------ ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
