<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body>
<p> </p>
<p>That's odd.  Please provide result of sessionInfo() and str(DT).</p>
<p>Matthew</p>
<p> </p>
<p>On 09.04.2013 11:32, David Bellot wrote:</p>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px; width:100%"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<div dir="ltr">
<div class="gmail_default" style="font-family: arial,helvetica,sans-serif; font-size: small;">Hi,<br /><br /></div>
<div class="gmail_default" style="font-family: arial,helvetica,sans-serif; font-size: small;">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.<br /><br /></div>
<div class="gmail_default" style="font-family: arial,helvetica,sans-serif; font-size: small;">Later on, I aggregate my DT with x like this:<br />agg = DT[ , list(m=mean(y), c=length(y)), by = c("x") ]<br /><br /></div>
<div class="gmail_default" style="font-family: arial,helvetica,sans-serif; font-size: small;">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.</div>
<div class="gmail_default" style="font-family: arial,helvetica,sans-serif; font-size: small;"><br />I'm sure I'm missing something totally obvious :-( !!!!<br /><br /></div>
<div class="gmail_default" style="font-family: arial,helvetica,sans-serif; font-size: small;">Any idea ?</div>
<div class="gmail_default" style="font-family: arial,helvetica,sans-serif; font-size: small;">Best,<br />David</div>
</div>
</blockquote>
<p> </p>
<div> </div>
</body></html>