Re: [R] column of a list

From: Sean Davis <sdavis2_at_mail.nih.gov>
Date: Wed 25 Jan 2006 - 00:36:31 EST

On 1/24/06 8:21 AM, "Thomas Steiner" <finbref.2006@gmail.com> wrote:

> I have a list of (same type) lists. I want to retrieve the same
> entries of all my objects in the outer list.
> eg:
> a<-list("2006-01-23"=list(r=5,s=c(7,12,12,11,4)),
> "2006-01-24"=list(r=6,s=c(3,8,8,9,12)))
> a[][["s"]]
>
> gives NULL, but I am looking for all the s-vectors in order to plot
> and compare them (e changes to f in a day).

This may not be the best solution, but:

 lapply(a,function(x) {x$s})

will get your answer, I think.

Sean



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 Wed Jan 25 00:56:58 2006

This archive was generated by hypermail 2.1.8 : Wed 25 Jan 2006 - 02:39:08 EST