Re: [R] Extract values from multiple lists

2014-12-17 Thread SH
Dear Dennis, David, Jeff, and Denes, Thanks for your helps and comments. The simple one seems good enough for my works. Best, Steve On Wed, Dec 17, 2014 at 5:46 AM, Dénes Tóth wrote: > > Dear Jeff, > > On 12/17/2014 01:46 AM, Jeff Newmiller wrote: > >> You are chasing ghosts of performance pa

Re: [R] Extract values from multiple lists

2014-12-17 Thread Dénes Tóth
Dear Jeff, On 12/17/2014 01:46 AM, Jeff Newmiller wrote: You are chasing ghosts of performance past, Denes. In terms of memory efficiency, yes. In terms of CPU time, there can be significant difference, see below. The data.frame function causes no problems, and if it is used then the OP w

Re: [R] Extract values from multiple lists

2014-12-16 Thread Jeff Newmiller
You are chasing ghosts of performance past, Denes. The data.frame function causes no problems, and if it is used then the OP would not need to presume they know the internal structure of the data frame. See below. (I am using R3.1.2.) a1 <- list(x = rnorm(1e6), y = rnorm(1e6)) a2 <- list(x = rn

Re: [R] Extract values from multiple lists

2014-12-16 Thread Dénes Tóth
On 12/16/2014 06:06 PM, SH wrote: Dear List, I hope this posting is not redundant. I have several list outputs with the same components. I ran a function with three different scenarios below (e.g., scen1, scen2, and scen3,...,scenN). I would like to extract the same components and group the

Re: [R] Extract values from multiple lists

2014-12-16 Thread David L Carlson
Something like scens <- paste0("scen", 1:N) new.df <- data.frame(sapply(scens, function(x) get(x)[["pop.inf.r"]])) - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-help [mailto: