Currently, there is one small inconsistency in row-subset using integer and logical types:
require(data.table)
DT <- data.table(x=1:2, y=c(TRUE, FALSE))
v1 = 1L
i as integer:
DT[1L]
# x y
#1: 1 TRUE
DT[x]
# Error in eval(expr, envir, enclos) : object 'x' not found
# Corrected the output here.. Thanks to @eddi.
DT[v1]
# x y
#1: 1 TRUE
DT[(x)]
# x y
#1: 1 TRUE
#2: 2 FALSE
The same happens for logical type as well.
The question is, can we get this indexing to work without the need for ( for cases where i is a column in DT instead of throwing the error?
Edit: Cleaned up noise and retained just the resolution.
Currently, there is one small inconsistency in row-subset using integer and logical types:
ias integer:The same happens for
logicaltype as well.The question is, can we get this indexing to work without the need for
(for cases whereiis a column inDTinstead of throwing the error?Edit: Cleaned up noise and retained just the resolution.