简体   繁体   English

无法从加载的包中找到函数

[英]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 (ie grid_metrics ).我创建了一个带有个人功能的本地包,以便在 R 中轻松使用。其中之一旨在用于包装器函数(即grid_metrics )内的lidR包。 For this reason I took the scheme of this script as a reference, exporting both the long name (eg my_metrics(param1, param2,...) ) and the lazy one (eg .my_metrics ), because I really like its ease of use.出于这个原因,我将这个脚本的方案作为参考,导出长名称(例如my_metrics(param1, param2,...) )和懒惰的(例如.my_metrics ),因为我真的很喜欢它的易用性.

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.在 NAMESPACE 文件中,我可以看到两个表单都被导出,所以我最后的猜测是这可能与lazyeval有某种lazyeval但我不知道如何。

It seems that the problem is related to the DESCRIPTION section in which the lidR package was included.问题似乎与包含lidR包的DESCRIPTION部分有关。 Since when I moved from Imports to Depends the issue is solved.自从我从Imports转移到Depends ,问题就解决了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM