[datatable-help] logicals in datatable i

Gabor Grothendieck ggrothendieck at gmail.com
Fri May 24 18:29:05 CEST 2013


The ?data.table page describing arg i says:

"integer and logical vectors work the same way they do in
[.data.frame. Other than NAs in logical i are treated as FALSE and a
single NA logical is not recycled to match the number of rows, as it
is in[.data.frame."

however, I get this:

> packageVersion("data.table")
[1] ‘1.8.9’

> DT1 <- data.table(a = 1:5)
> DT1[as.logical(NA)]
    a
1: NA

so it seems that if there is a single logical NA it not only is not
recycled but it also is not regarded as FALSE (whereas the quoted
statement seems to say a logical NA is regarded as FALSE in all
cases).

Is this intended?

--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com


More information about the datatable-help mailing list