... Problem solved (it helps to import data.table into the package...)

Thanks, M


On 03/16/2014 04:02 PM, Michael Smith wrote:
> 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
> 
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

Reply via email to