data.table in R: Why can't data.table::`:=`() be called? -
use dt = data.table(type=rep(c("b","a"),each=2), value=1:4)
create following data.table:
type value 1: b 1 2: b 2 3: 3 4: 4
the code dt[, `:=`(text=max(value)), by=type]
works well:
type value test 1: b 1 2 2: b 2 2 3: 3 4 4: 4 4
same code (except data.table::
calling part) dt[, data.table::`:=`(text=max(value)), by=type]
doesn't work , returns following error:
error in data.table::`:=`(text = max(value)) : check is.data.table(dt) == true. otherwise, := , `:=`(...) defined use in j, once , in particular ways. see help(":=").
can tell me why can't call :=
function data.table::`:=`()
can call other functions data.table
data.table::data.table
?
please me, want use data.table::`:=`()
in package.
many ahead!
Comments
Post a Comment