Re: [R] parsing '...' function argument?

From: Berton Gunter <gunter.berton_at_gene.com>
Date: Fri 01 Jul 2005 - 02:31:31 EST


See pages 45 and 46 of V&R's S PROGRAMMING for a definitive discussion of how to do this.

(Confession: I treat anything that V&R say as definitive).

Cheers,
Bert Gunter  

> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Gabor
> Grothendieck
> Sent: Thursday, June 30, 2005 4:34 AM
> To: Oleg Sklyar
> Cc: r-help@stat.math.ethz.ch
> Subject: Re: [R] parsing '...' function argument?
>
> On 6/30/05, Oleg Sklyar <osklyar@ebi.ac.uk> wrote:
> > Dear community,
> >
> > I am writing a wrapper for '[' operator, which is a generic method
> > declared as function(x, i, j, ..., drop). It turns out that
> I need to
> > parse the '...' argument and this is where I am stuck.
> Generally what I
> > need is the following. Say the call is obj[1, 1, 1:10, 3] -
> here '1:10,
> > 3' is passed into '...'. What I need to evaluate that '...'
> contains now
> > 2 arguments, first is a vector of 10 elements and second is a single
> > value. Even nicer situation is in call obj[1, 1, , 3] -
> where ' , 3' is
> > passed in '...' with one missing argument, which for an
> array would mean
> > the full range. Any ideas? (Just to mention - if there were only one
> > argument in '...', say '1:10', then length(...) would
> return 10 and one
> > could access elements by ...[[i]], but all this fails if
> there are two
> > arguments or more).
> >
>
> Check out the technique used in this post:
>
> http://tolstoy.newcastle.edu.au/R/help/04/06/1430.html
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Jul 01 02:42:18 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:08 EST