[Rd] Changing "..." inside a function: impossible? desirable?

Luke Tierney luke@stat.uiowa.edu
Tue Dec 17 22:16:03 2002


On Tue, 17 Dec 2002, Martin Maechler wrote:

> 
> It's clear that some things in "..." can be passed to title() and
> some to axis(), etc.
> Of course the above is really silly, but I have a situation
> where I'd like to see if something, say, `myarg' is part of "..."  
> {piece of cake easy, see below} but then I want to  *eliminate*
> it from "..." such that I can pass "..." down to other functions
> which would want to see a `myarg' argument.
> 
> Something like
> 
> if("myarg" %in% (naml <- names(list(...)))) {
>    ## ok, it's there, take it out
>    marg <- list(...)$ marg
> 
>    ## what I now would like is  
> 
>    ...  <-  unlist( list(...)["myarg" != naml] )
> }
> 

Does'nt

function(x, y, myarg, ...) {
    if(! missing(myarg)) {
       ## ok, it's there, do whatever
    }
    ....


i.e. just remove the things you explicitly want not in ... by naming
them as arguments work for your setting?

luke


-- 
Luke Tierney
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
   Actuarial Science
241 Schaeffer Hall                  email:      luke@stat.uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu