Hi,

I have a long list of lists from which I want to efficiently extract
and rbind elements. So I'm using the approach below:


f <- function(i){
    out <- replicate(5, list(matrix(rnorm(80), nc=20)))
    names(out) <- letters[1:5]
    out
}
set.seed(1)
lst <- lapply(1:1.5e6, f)
(t0 <- system.time(tmp <- do.call(rbind, lapply(lst, '[[', 'b'))))


Is there anything better/faster than the do.call+rbind+lapply combo
above? On this example, the combo takes roughly 20s on my machine...
but on the data I'm working with, it takes more than 1 minute... And
given that I need to repeat the task several times, the cumul. amount
of time is significant for me.

Thank you for any suggestion/comment,

benilton

______________________________________________
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.

Reply via email to