[datatable-help] `:=` Fails When Called From Function Inside a Package
Michael Smith
my.r.help at gmail.com
Sun Mar 16 09:02:39 CET 2014
All,
This is my first post on this list, thanks to all those who have made
data.table such a wonderful package.
I have a simple function that looks like this (for reproducibility):
myfun <- function() {
DT <- data.table(a = 1:4, b = 5:8)
DT[, x := a + 2]
DT
}
It works perfectly fine, until I add it to a custom R package that I
just wrote. If I add it to the package and try to call it, I get the
following error:
> mypackage::myfun()
Error in `:=`(x, a + 2) :
Check that is.data.table(DT) == TRUE. Otherwise, := and `:=`(...) are
defined for use in j, once only and in particular ways. See help(":=").
Not really sure what's going on here. Any ideas? Is this a bug or am I
doing something wrong?
Thanks,
M
More information about the datatable-help
mailing list