How to use `: =` from data.table when data.table is not loading

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 :=:? !!

+4
source share
1 answer

Not sure what I understand correctly, but regarding:

I am going to use this in another package, and it is advisable that I do not load data.table. - newbie

, , data.table , . ? -

data.table, . , , - . . :

data.table

+1

Source: https://habr.com/ru/post/1628402/


All Articles