Maybe some can tell me why the names I assigned to "idVars" are changing after adding a column to my data.table (without reassigning them)? How can I persist the assignment to store only the first two column names?
Thanks!
library(data.table)
DT <- data.table(a=1:10, b=1:10)
idVars <- names(DT)
print(idVars)
# [1] "a" "b"
DT[, "c" := 1:10]
print(idVars)
# [1] "a" "b" "c"
# devtools::session_info()
# data.table * 1.11.6 2018-09-19 CRAN (R 3.5.1)