here is a data.table:
Date colA colB colC .... month year
01/23/15 2323 2323 2323 january 2015
.......
On this data.table Im trying to: 1) Sum all column values by month and then year 2) In the subset returned I want to exclude the Date column
I have set keys on the DT as follows:
setkey(DT, month, year)
Now Im running this command to achieve the operations listed in steps 1 & 2 above:
DT[ ,lapply(.SD, sum, na.rm=TRUE), by=.(month , year), .SDcols= 2:(length(colnames(DT))-2) ]
I got the above example from this SO post here.
When I run this..... I get the following error:
Error in gsum(`colA`, na.rm = TRUE) :
Type 'character' not supported by GForce sum (gsum). Either add the prefix base::sum(.) or turn off GForce optimization using options(datatable.optimize=1)
Im not sure what this means and how to debug it.......
Any assistance would be appreciated. Thanks