Re: [R] Summarizing elements of a list

2011-12-02 Thread R. Michael Weylandt
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

Re: [R] Summarizing elements of a list

2011-12-02 Thread LCOG1
Great, this worked the fastest of all the suggestions. Cheers, Josh From: Michael Weylandt [via R] [mailto:ml-node+s789695n414494...@n4.nabble.com] Sent: Thursday, December 01, 2011 8:11 PM To: ROLL Josh F Subject: Re: Summarizing elements of a list Similarly, t

Re: [R] Summarizing elements of a list

2011-12-02 Thread LCOG1
Thank you for the help, I knew it could be done with a member of the apply family. I struggle with apply stuff though, its not always intuitive for me with these functions. Cheers, JR From: Sarah Goslee [via R] [mailto:ml-node+s789695n414453...@n4.nabble.com] S

Re: [R] Summarizing elements of a list

2011-12-01 Thread R. Michael Weylandt
Similarly, this might work: unlist(lapply(Version1_, `[`,"First")) Michael On Thu, Dec 1, 2011 at 9:41 PM, Sarah Goslee wrote: > How about: > > lapply(Version1_, subset, subset=c(TRUE, FALSE)) > or sapply() depending on what you want the result to look like. > > Thanks for the reproducible exam

Re: [R] Summarizing elements of a list

2011-12-01 Thread Sarah Goslee
How about: lapply(Version1_, subset, subset=c(TRUE, FALSE)) or sapply() depending on what you want the result to look like. Thanks for the reproducible example. Sarah On Thu, Dec 1, 2011 at 5:17 PM, LCOG1 wrote: > Hi everyone, >   I looked around the list for a while but couldn't find a soluti

[R] Summarizing elements of a list

2011-12-01 Thread LCOG1
Hi everyone, I looked around the list for a while but couldn't find a solution to my problem. I am storing some results to a simulation in a list and for each element i have two separate vectors(is that what they are called, correct my vocab if necessary). See below Version1_<-list() for(i in

Re: [R] Summarizing elements of a list

2011-12-01 Thread B77S
Someone is bound to know a better way, but... subset(unlist(Version1_), subset=names(unlist(Version1_))=="First") LCOG1 wrote > > Hi everyone, >I looked around the list for a while but couldn't find a solution to my > problem. I am storing some results to a simulation in a list and fo