I think that is cart-before-horse. It is not implemented in R, and there
was a request (nay, a bug report, PR#1558, by one of your colleagues) on
this. It just does not occur in any of the commonly-used S library
sections which have been ported to R.
I surmised at that time that people have not found it useful. I never
have. It must take a certain type of problem (or mindset) to work with
lists of lists of lists.
Brian
On Mon, 28 Oct 2002 Nick.Ellis@csiro.au wrote:
> I got one reply on this indexing feature from Bill Venables. He pointed out
> that this form of indexing does not occur in R. That may explain why it is
> rarely used, as one would try to avoid incompatibilities between the two
> flavours of S.
>
> Splus> list(list(list(1)))[[c(1,1,1)]]
> [1] 1
>
> R> list(list(list(1)))[[c(1,1,1)]]
> Error: attempt to select more than one element
>
> Nick Ellis
> CSIRO Marine Research mailto:Nick.Ellis@csiro.au
> PO Box 120 ph +61 (07) 3826 7260
> Cleveland QLD 4163 fax +61 (07) 3826 7222
> Australia http://www.marine.csiro.au
>
> > -----Original Message-----
> > From: Nick.Ellis@csiro.au [mailto:Nick.Ellis@csiro.au]
> > Sent: Thursday, October 24, 2002 10:49 AM
> > To: s.su@qut.edu.au
> > Cc: s-news@lists.biostat.wustl.edu
> > Subject: Re: [S] indexing within a list using Splus 2000 and Splus 6
> >
> > For instance
> > A[[c(1,2,3)]] is the same
> > as A[[1]][[2]][[3]].
> >
> > To the s-news community:
> > I don't remember anyone using this form of indexing on
> > s-news. I wonder if
> > anyone routinely uses this kind of indexing, and would like
> > to share any
> > tricks? The feature is not described under help("[["); you
> > have to go to the
> > Programmers' Guide, Chapter 4, section "Subscripting Lists".
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
|