lapply(lst, function(x) return(x[[2]])) On Fri, Jan 11, 2013 at 6:40 AM, Bjoern Helm <bjoern.h...@tu-dresden.de> wrote: > Dear R users,I have a list of equally structured lists, how can I access e.g. > all 2nd compontents in those sub-lists?An example:lst <- > list(rep(list(1:3),3), rep(list(4:6),3))> lst[[1]][[1]][[1]][1] 1 2 > 3[[1]][[2]][1] 1 2 3[[1]][[3]][1] 1 2 3[[2]][[2]][[1]][1] 4 5 6[[2]][[2]][1] > 4 5 6[[2]][[3]][1] 4 5 6What I want to get are all second sub-lists, in this > case:[[1]][[2]][1] 1 2 3and[[2]][[2]][1] 4 5 6many thanksBjörn > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/Access-comonents-in-lists-of-lists-tp4655224.html > Sent from the R help mailing list archive at Nabble.com. > [[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. >
______________________________________________ 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.