<div dir="ltr">Maybe I'm missing smth, but what else did you expect? Looks like it did it's best to compensate for the user not supplying full data in the first example, and there really was nothing to do in the second one.<div>
<div style><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 17, 2013 at 3:27 PM, Gabor Grothendieck <span dir="ltr"><<a href="mailto:ggrothendieck@gmail.com" target="_blank">ggrothendieck@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Is this intended?  If we use j = list(x = "X", y = numeric(0)) we get<br>
a row but if we use just list(y = numeric(0)) then we do not get a<br>
row.  In the first case it filled in the zero length component with NA<br>
and in the second case it just omitted the row entirely:<br>
<br>
> dd <- data.table(a = 1:3)<br>
> dd<br>
   a<br>
1: 1<br>
2: 2<br>
3: 3<br>
> dd[, list(x = "X", y = numeric(0)), by = a]<br>
   a x  y<br>
1: 1 X NA<br>
2: 2 X NA<br>
3: 3 X NA<br>
> dd[, list(y = numeric(0)), by = a]<br>
Empty data.table (0 rows) of 2 cols: a,y<br>
<br>
<br>
--<br>
Statistics & Software Consulting<br>
GKX Group, GKX Associates Inc.<br>
tel: 1-877-GKX-GROUP<br>
email: ggrothendieck at <a href="http://gmail.com" target="_blank">gmail.com</a><br>
_______________________________________________<br>
datatable-help mailing list<br>
<a href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a><br>
</blockquote></div><br></div>