[datatable-help] aggregating data

David Bellot david.bellot at gmail.com
Tue Apr 9 12:32:38 CEST 2013


Hi,

I have a data.table DT with one of the column named x and I other names,
let's say, a1, a2, ... aN. The key of this data.table is made of a1...aN.

Later on, I aggregate my DT with x like this:
agg = DT[ , list(m=mean(y), c=length(y)), by = c("x") ]

The problem is that "x" has 331 unique values as found by
length(unique(DT$x)) but my result "agg" only has 119 rows. I tried by
changing the key to "x" alone but the problem persists. My DT table has a
few millions rows by the way.

I'm sure I'm missing something totally obvious :-( !!!!

Any idea ?

Best,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20130409/1718fe38/attachment.html>


More information about the datatable-help mailing list