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".
>
|