This question pertains to creating \"wide\" tables similar to tables you could create using dcast from reshape2. I know this has been discussed many times before, but my que
For n=1e6 the following takes about 10 seconds with plain dcast and about 4 seconds with dcast.data.table:
n=1e6
dcast
dcast.data.table
library(reshape2) dcast(z[, sum(price), by = list(c1, c2, c3)], c1 + c2 ~ c3) # or with 1.8.11 dcast.data.table(z, c1 + c2 ~ c3, fun = sum)