Displaying 1 result from an estimated 1 matches for "resultdf4b".
Did you mean:
resultdf4
2010 Sep 09
0
Fast / dependable way to "stack together" data frames from a list
...bout the difference between matrix and data.frame
### turns out to be important. Do it again, but don't
### make the intermediate storage thing a data.frame:
mylist2 <- lapply(mylist, as.matrix)
m <- length(mylist2)
nr <- nrow(mylist2[[1]])
nc <- ncol(mylist2[[1]])
system.time(
resultDF4B <- matrix(0, nrow = nr*m, ncol = nc)
)
colnames(resultDF4B) <- colnames(mylist[[1]])
system.time(
for (j in 1:m) resultDF4B[(((j-1)*nr) + 1):(j*nr), ] <- mylist2[[j]]
)
### That's FAST!
### user system elapsed
### 0.07 0.00 0.07
all.equal(resultDF, as.data.frame(res...