From luke@stat.uiowa.edu  Tue Dec 17 22:16:03 2002
From: luke@stat.uiowa.edu (Luke Tierney)
Date: Tue Dec 17 22:16:03 2002
Subject: [Rd] Changing "..." inside a function: impossible? desirable?
In-Reply-To: <15871.26572.352351.211263@gargle.gargle.HOWL>
Message-ID: <Pine.LNX.4.44.0212171507550.13373-100000@itasca.stat.uiowa.edu>

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



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