I want to use: = operator from data.table without loading data.table. For example, for the following data table. I want to add another column called error.
DT <- data.table::data.table(station = rep(1:1,52560), mod = rnorm(1*52560),obs = rnorm(1*52560))
If I do the following, everything goes well, however, I am puzzled by how it works without referring to the data.table package (data library. Table not loaded)? !!
DT[ , `:=`(error = mod - obs)]
How to rewrite the above line using data.table :=:? !!
source
share