> How would we do this problem looping over seq(1:2) ? > > To extend the example in the corresponding nabble post : - sub1<-list(x="a",y="ab") sub2<-list(x="c",y="ad") lst<-list(sub1=sub1,sub2=sub2) for ( t in seq(1:2) ) print(lst[[t]]$y)
So I can print out the sub1$y/sub2$y but it's not clear how to extract them. My original was different though. How would say:- for ( t in seq(1:2) ) sub"t"$y Where sub"t" evaluates to sub1 or sub 2? Many thanks. Ashim > On Thu, Aug 4, 2011 at 10:59 AM, Richard Ma <xuanlong...@uts.edu.au>wrote: > >> Thank you so much GlenB! >> >> I got it done using your method. >> >> I'm just curious how did you get this idea? Cause for me, this looks so >> tricky.... >> >> Cheers, >> Richard >> >> ----- >> I'm a PhD student interested in Remote Sensing and R Programming. >> -- >> View this message in context: >> http://r.789695.n4.nabble.com/How-to-extract-sublist-from-a-list-tp3717451p3717713.html >> Sent from the R help mailing list archive at Nabble.com. >> >> ______________________________________________ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.