I've done a package in R and included some data.table code inside my function:
ntalls[,.(NoMeas=sum(numer)),by=.(lance,esp,sexo,cate)]
ntalls is a data.table, and the code works fine as script when data.table is called in the workspace, but when I run the function inside the package I get:
Error in .(NoMeas = sum(numer)) : could not find function "."
data.table is included in the DESCRIPTION of the library, and even loaded as require(data.table) inside the function. The package is built and compiled in Rstudio using R 3.5.0
How do I call data.table:: inside the function?
found the solution, or at least something that works:
including depends data.table in DESCRIPTION makes the package available so there's no need to use require(data.table) within the functions an the package works though it is much larger.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With