# example data
set.seed(1)
n = 1e7
ng = 1e4
DT = data.table(
g1 = sample(ng, n, replace=TRUE),
g2 = sample(ng, n, replace=TRUE),
v = rnorm(n)
)
Matching on one column
After the first run of a subsetting operation with == or %in%...
system.time(
DT[ g1 %in% 1:100]
)...