When a data.table
secondary index is set on on a numeric vector, it does not seem to allow for subsetting rows using the on =
syntax. However, I couldn't see anything in the documentation that would indicate that only character columns can be secondary indices. Is the on =
syntax limited to character columns?
library(data.table)
dt <- data.table(A = 1:10, B = letters[1:10])
setindex(dt, A, B)
dt[on = "B", "c"]
dt[on = "A", 3]