Not at the moment because of the checks. If it's a call, and the first index
value is `!`, it's removed and then the rest is checked if it's a "name", which
is true for `t1[!b]`. And i by default searches the calling scope - because `i`
can be a data.table. That is, `X[!Y]` is intended to be used for `Y` being a
data.table. Hence the difference between `X[!Y]` and `X[(!Y)]` at the moment.
But in 1.9.3, this'll get better: Have a look at
https://github.com/Rdatatable/data.table/issues/697 and
https://github.com/Rdatatable/data.table/issues/633
Arun
From: Stavros Macrakis (Σταῦρος Μακράκης) [email protected]
Reply: Stavros Macrakis (Σταῦρος Μακράκης) [email protected]
Date: June 30, 2014 at 6:06:53 PM
To: [email protected] [email protected]
Subject: [datatable-help] i = !x different from i = (!x)
DT 1.9.2
t1 <- data.table(a=1:2,b=0:1,key="a")
t1[b==0] => row 1, OK
t1[!b] => ERROR "object 'b' not found" ??
t1[(!b)] => row 1, OK
Shouldn't !b be equivalent to (!b)? They are both expressions, not symbols.
-s
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help