[R] rbind-ing vectors inside lists

Richard M. Heiberger rmh at temple.edu
Thu Aug 17 20:11:08 CEST 2006


## initial example
a = list(1:5, 5:9)
b = lapply(a,"*",2)

library(abind)  ## you may need to download abind from CRAN
abind(data.frame(a), data.frame(b), along=.5)

## data.frames with column names
a = data.frame(first=1:5, second=5:9)
b = a^2
abind(a, b, along=.5, new.names=c("a","b"))



More information about the R-help mailing list