Skip to content

Access comonents in lists of lists

3 messages · Bjoern Helm, Ista Zahn, Rolf Turner

#
lapply(lst, function(x) return(x[[2]]))
On Fri, Jan 11, 2013 at 6:40 AM, Bjoern Helm <bjoern.helm at tu-dresden.de> wrote:
#
On 01/12/2013 12:40 AM, Bjoern Helm wrote:
Your email was/is a bit hard to read .... but if I understand correctly, 
what
you want is

     lst2 <- lapply(lst,function(x){x[[2]]})

See ?lapply.  Also associated functions like tapply() and sapply(). Very
useful gadgets.  And if you really get hooked on such functionality, you
might want to have a look at the "plyr" package.

     cheers,

         Rolf Turner