Skip to content
Prev 279168 / 398502 Next

Summarizing elements of a list

Here's a slight modification that is even faster if speed is a consideration:

sapply(Version1_, `[[`, "First")

The thought process is to go through the list "Version1_" and apply
the operation `[[` to each element individually. This requires a
second operator (here the element name "First") which we pass through
the "..." of sapply() -- I hope that helps you get a sense of the
mechanics. We use sapply() instead of lapply() because it does some
internal simplification for us to get one big vector back, effectively
cutting out the "unlist" of the first solution I gave you.

Michael
On Fri, Dec 2, 2011 at 2:04 PM, LCOG1 <jroll at lcog.org> wrote: