For compound keys, you can use the following
DT[.("b")][!.(x, 3)] # x is the name of first column of key
In general, you can link several [ ] [ ] to filter to the desired results.
Please note that you can also easily use logical operators in i of data.table .
The syntax is J() - or now .( ) Is just a shorthand convenience.
You can use almost everything that could be included in the if clause in order to access the column names as variables.
In your specific example, you would use x=="b" & y != 3 pay attention to a single & , not && .
DT[ x=="b" & y != 3]
You can also combine vector checks with binary search data.table as follows
DT[.("b")][y != 3]
source share