【发布时间】:2017-11-20 09:39:59
【问题描述】:
我使用devtools 创建的自定义包安装、加载、显示功能的帮助文件,但不提供功能。 This solution 似乎不相关,因为我的包安装在 .libPaths() 中。
# from the parent directory of the created package
install.packages("mypkg", repos = NULL, type = "source")
# ...
# * DONE (mypkg)
require(mypkg)
# Loading required package: mypkg
?my.fun # displays the function help documentation correctly
my.fun()
错误:找不到函数“my.fun”
是什么导致了这种行为以及如何解决它?
sessionInfo()
#R version 3.3.0 (2016-05-03)
#Platform: x86_64-apple-darwin13.4.0 (64-bit)
#Running under: OS X 10.13.1 (unknown)
#locale:
#[1] cs_CZ.UTF-8/cs_CZ.UTF-8/cs_CZ.UTF-8/C/cs_CZ.UTF-8/cs_CZ.UTF-8
#attached base packages:
#[1] stats graphics grDevices utils datasets methods base
#other attached packages:
#[1] mypkg_0.1 devtools_1.13.4
#loaded via a namespace (and not attached):
#[1] tools_3.3.0 withr_2.1.0 memoise_1.0.0 git2r_0.19.0 digest_0.6.9
【问题讨论】:
-
你导出函数了吗?要检查它是否在包中运行:
mypkg:::my.fun() -
@trosendal 谢谢!是的,就是这样。在我的函数中错过了
@export标签。如果您将评论更改为答案,我将提供信用。