From Martin Maechler <maechler@stat.math.ethz.ch>  Wed Dec 18 08:37:03 2002
From: Martin Maechler <maechler@stat.math.ethz.ch> (Martin Maechler)
Date: Wed Dec 18 08:37:03 2002
Subject: [Rd] Changing "..." inside a function: impossible? desirable?
In-Reply-To: <Pine.LNX.4.44.0212171507550.13373-100000@itasca.stat.uiowa.edu>
References: <15871.26572.352351.211263@gargle.gargle.HOWL>
 <Pine.LNX.4.44.0212171507550.13373-100000@itasca.stat.uiowa.edu>
Message-ID: <15872.9556.913993.601421@gargle.gargle.HOWL>

>>>>> "Luke" == Luke Tierney <luke@stat.uiowa.edu>
>>>>>     on Tue, 17 Dec 2002 15:12:40 -0600 (CST) writes:

    Luke> 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] ) }
    >> 

    Luke> Doesn't

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


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

Sure.  That's the standard approach I have been using many times
in the past (and still!).

For the (many!) graphics parameters, 
this leads to very many new arguments also differing between
context, i.e.  cex.axis, cex.main, ....

Fiddling with "..." could have been a  alternative..
and also a general `language utility', 
Martin



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