Fast melted data.table operations
I am looking for patterns for manipulating data.table objects whose structure resembles that of dataframes created with melt from the reshape2 package. I am dealing with data tables with millions of rows. Performance is critical. The generalized form of the question is whether there is a way to perform grouping based on a subset of values in a column and have the result of the grouping operation create one or more new columns. A specific form of the question could be how to use data.table to accomplish the equivalent of what dcast does in the following: input <- data.table( id=c(1, 1, 1, 2, 2,