3
votes

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?

1
Could you share the solution here? There is no definite answer highlighted over there.thelatemail
I,ve found the solution in running a function inside a package the solutions was to include depends data.table in DESCRIPTION file of the project. Thanks for the editions mustaccioFranVel

1 Answers

5
votes

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.