<div>
                    Gabor,
                </div><div><br></div><div>Not sure if this is intended, but the there's a code that explicitly assigns NA_integer_ if `i` is NA in `[.data.table`:</div><div><br></div><div><div>if (is.logical(i)) {</div><div>    if (identical(i, NA)) </div><div>        i = NA_integer_</div><div>    else i[is.na(i)] = FALSE</div><div>}</div></div><div><br></div><div>So, if `i` is JUST `NA`, then it's replaced with NA_integer_. If there are more than 1 element and i has NA in them, they are replaced with FALSE.</div><div><br></div><div>For ex: doing </div><div>DT1[as.logical(c(NA, NA))]</div><div><br></div><div>would result in recycling and lead to a 0 rows and 1 column empty data.table.</div>
                <div><div><br></div><div>Arun</div><div><br></div></div>
                 
                <p style="color: #A0A0A8;">On Friday, May 24, 2013 at 6:29 PM, Gabor Grothendieck wrote:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div><div>The ?data.table page describing arg i says:</div><div><br></div><div>"integer and logical vectors work the same way they do in</div><div>[.data.frame. Other than NAs in logical i are treated as FALSE and a</div><div>single NA logical is not recycled to match the number of rows, as it</div><div>is in[.data.frame."</div><div><br></div><div>however, I get this:</div><div><br></div><blockquote type="cite"><div>packageVersion("data.table")</div></blockquote><div>[1] ‘1.8.9’</div><div><br></div><blockquote type="cite"><div><div>DT1 <- data.table(a = 1:5)</div><div>DT1[as.logical(NA)]</div></div></blockquote><div>    a</div><div>1: NA</div><div><br></div><div>so it seems that if there is a single logical NA it not only is not</div><div>recycled but it also is not regarded as FALSE (whereas the quoted</div><div>statement seems to say a logical NA is regarded as FALSE in all</div><div>cases).</div><div><br></div><div>Is this intended?</div><div><br></div><div>--</div><div>Statistics & Software Consulting</div><div>GKX Group, GKX Associates Inc.</div><div>tel: 1-877-GKX-GROUP</div><div>email: ggrothendieck at <a href="http://gmail.com">gmail.com</a></div><div>_______________________________________________</div><div>datatable-help mailing list</div><div><a href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a></div><div><a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a></div></div></div></span>
                 
                 
                 
                 
                </blockquote>
                 
                <div>
                    <br>
                </div>