Re: [R] Accessing the elements of a list

2008-02-01 Thread Thibaut Jombart
Shubha Vishwanath Karanth wrote: > Hi R, > > > > I wanted to know how do we access the elements of a list. In particular, > > > > v=list(c(1,2,3,4,5),c(1,2,33,4,5),c(1,2,333,4,5),c(1,2,,4,5)) > > > > I want to access all the thirds items of the elements of the list. i.e., > I want to acce

Re: [R] Accessing the elements of a list

2008-02-01 Thread Bill.Venables
I find it hard to imagine you need to do it without using sapply. If you get over your phobia, you might like to try sapply(v, "[", 3) If the elements of the list are all the same length, as in your example, you could do data.frame(v)[3, ] I think we need to know more about why you think you