The allocation behavior seems to be changed. The truelength() is largely reduced after any subsetting. Massive adding columns to the under-allocated data.table in other environment would fail to apply to the original object.
library(data.table)
dt <- data.table(id = 1:1000)
dt[, x := rnorm(.N)]
truelength(dt)
#> [1] 1025
dt1 <- dt[x > 0]
truelength(dt1)
#> [1] 66
The allocation behavior seems to be changed. The
truelength()is largely reduced after any subsetting. Massive adding columns to the under-allocated data.table in other environment would fail to apply to the original object.