I've noticed that cbind takes considerably longer than rbind for data.tables. What is the reason for this?
> dt <- as.data.table(mtcars)
> new.dt <- copy(dt)
> timeit({for (i in 1:100) dt.new <- rbind(dt.new, dt)})
user system elapsed
0.237 0.012 0.253
> new.dt <- copy(dt)
> timeit({for (i in 1:100) dt.new <- cbind(dt.new, dt)})
user system elapsed
14.795 0.090 14.912
Where
timeit <- function(expr)
{
ptm <- proc.time()
expr
proc.time() - ptm
}