Hello,

Em 12-10-2014 18:26, David Winsemius escreveu:

On Oct 12, 2014, at 8:45 AM, Rui Barradas wrote:

Hello,

Try the following.

do.call(rbind, lapply(a, '[[', "var1"))
do.call(rbind, lapply(a, '[[', "var2"))

Could perhaps (untested) make it more general with:

do.call(rbind, lapply(a, '[[', names(a[[1]])[1]))
do.call(rbind, lapply(a, '[[', names(a[[1]])[2]))

And then seeing that, could perhaps make it a one-liner with:

lapply( names(a[[1]]),   function(nm) do.call(rbind, lapply(a, '[[', nm)) )

Yes, I had thought of

lapply(seq_along(a[[1]]), function(i) do.call(rbind, lapply(a, '[[', i)))


Rui Barradas


______________________________________________
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