Hello,

I was wondering what is the best way to reshape a data table.  Is it
appropriate to use the 'reshape' function in base r, or is there a better
way?

Here is an example:

library(data.table)set.seed(1234)
DT <- data.table(x=rep(c("a","b","c"),each=4), y=c("AA","BB"),
v=sample(1:100,12)out <- DT[,sum(v),by='x,y']
names(out)[3] <- 'SUM'out <- reshape(out,direction='wide',idvar='x',
timevar='y')

Thank you.

-Zach
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

Reply via email to