Search code examples
rlazyeval

can't find a function from loaded package


I created a local package with personal functions to be easily used within R. One of these is aimed to be used in the lidR package within a wrapper function (i.e. grid_metrics). For this reason I took the scheme of this script as a reference, exporting both the long name (e.g. my_metrics(param1, param2,...)) and the lazy one (e.g. .my_metrics), because I really like its ease of use.

Nevertheless, if I load my package and then call the lazy function

library(mypackage)
test = grid_metrics(las, .my_metrics, 20)

it does not work, so I have to load in memory the function by running its code from the file. At this stage, I can use it in both forms.

Within the NAMESPACE file I can see that both forms are exported so my last guess is that this might be related somehow to lazyeval but I don't get how.


Solution

  • It seems that the problem is related to the DESCRIPTION section in which the lidR package was included. Since when I moved from Imports to Depends the issue is solved.