<div dir="ltr">data.frame does the same thing:<div><br></div><div><div>  > rbind.data.frame(NULL, NULL)</div><div>  data frame with 0 columns and 0 rows</div></div><div><div>  > data.frame(NULL)</div><div>  data frame with 0 columns and 0 rows</div>

</div><div><br></div><div>rbind(NULL, NULL) is just a different beast.</div><div><br></div><div>A part of me want to have an is.null generic function, but then it's not clear how you'd check for NULL.</div><div><br>

</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 29, 2013 at 2:17 PM, <a href="mailto:caneff@gmail.com">caneff@gmail.com</a> <span dir="ltr"><<a href="mailto:caneff@gmail.com" target="_blank">caneff@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yes I can. I suppose the actual inconsistency lies in rbind.data.frame then. It doesn't follow the same guarantee of "always outputs a data.table". Otherwise<br>

<div><br></div><div>rbind(NULL, NULL)</div><div>
<br></div><div>and </div><div><br></div><div>data.frame(NULL)</div><div><br></div><div>would have the same result.</div><div><br></div><div><br></div><div>Maybe I would wonder if calling it a "null data.table" is the right terminology, since it really is just an empty data.table.  A null data.table would imply that is.null would be true.</div>

<div class="HOEnZb"><div class="h5">
<br><div>On Tue Oct 29 2013 at 2:11:30 PM, Eduard Antonyan <<a href="mailto:eduard.antonyan@gmail.com" target="_blank">eduard.antonyan@gmail.com</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div dir="ltr">perhaps you can use length() == 0 instead of is.null() for your purposes</div><div><br><br><div>On Tue, Oct 29, 2013 at 1:01 PM, Eduard Antonyan <span dir="ltr"><<a href="mailto:eduard.antonyan@gmail.com" target="_blank">eduard.antonyan@gmail.com</a>></span> wrote:<br>




<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">This is by design, and is not a bug.<div><br></div><div>If you try<br></div><div><div><br></div><div>    data.table:::.rbind.data.table(NULL, NULL)</div>




<div><br></div><div>in version 1.8.10 you will also get a 0-size data.table in agreement with rbindlist (if you try the above in the very latest version, you will get an error, and I may change that to be same as 1.8.10 - but it doesn't matter much, as you can't get there unless you use ":::", and then all bets are off anyway). Both are supposed to always return data.tables.</div>





<div><br></div><div>The reason you're getting something else with rbind(NULL, NULL) is because those NULL's are not data.tables, so a *different* rbind is called, which has nothing to do with data.table.</div></div>





<div><br></div></div><div><br><br><div><div><div>On Tue, Oct 29, 2013 at 12:47 PM, Chris Neff <span dir="ltr"><<a href="mailto:caneff@gmail.com" target="_blank">caneff@gmail.com</a>></span> wrote:<br>


</div></div><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Simple thing:<div><br></div><div>dt <- rbindlist(list(NULL, NULL)) #dt is a data.table with 0 rows and columns</div>





<div><br></div><div>is.null(dt) # Prints false</div><div><br></div><div>d <- rbind(NULL, NULL)  #d is NULL</div>

<div><br></div><div>is.null(d) # Prints true</div><div><br></div><div><br></div><div>I would expect the two to be equivalent.  This bit me when I was relying on !is.null(dt) before assigning other columns in the data.table.  rbindlist should return NULL in this case I would think. </div>







<div><br></div><div>Is this working as intended? Or should I file a bug?</div></div>
<br></div></div>_______________________________________________<br>
datatable-help mailing list<br>
<a href="mailto:datatable-help@lists.r-forge.r-project.org" target="_blank">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>
</blockquote></div><br></div>
</blockquote>
</div></div></blockquote></div><br></div>