Given three (or nlists):
one <- list(a=1:2,b="one")
two <- list(a=2:3,b="two")
three <- list(a=3:4,b="three")
What would be a more efficient way to cbindindex each element of a list in lists nto get this result?
mapply(cbind,mapply(cbind,one,two,SIMPLIFY=FALSE),three,SIMPLIFY=FALSE)
$a
[,1] [,2] [,3]
[1,] 1 2 3
[2,] 2 3 4
$b
[,1] [,2] [,3]
[1,] "one" "two" "three"
This works fine when nthere is 2or 3, but will quickly become ridiculously complex. Is there a more efficient variation on this? I saw similar questions on S.O. but tried to adapt them.
source
share