【发布时间】:2014-11-02 18:22:56
【问题描述】:
我使用 Roxygen2 编写了一个 R 包来创建帮助文件和命名空间。我去的时候
install_github("mintUser/bedarfspruefung3")
我得到以下输出和错误:
* installing *source* package ‘bedarfspruefungV03’ ...
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in namespaceExport(ns, exports) :
undefined exports: KiSt, LST2014, MLSTJAHR, MOSONST, MRE4, MRE4ABZ, MRE4ALTE, MRE4JL, MRE4SONST, MSOLZ, MSONST, MST56, MVMT, MVSP, MZTABFB, SolZ, SozV, UP56, UPANTEIL, UPEVP, UPLSTLZZ, UPMLST, UPTAB14, UPVKV, UPVKVLZZ, bedarfspruefung2, leistungALGII2, rating
ERROR: loading failed
Roxygen 正确构建了 NAMESPACE 文件:
# Generated by roxygen2 (4.0.2): do not edit by hand
export(KiSt)
export(LST2014)
export(MLSTJAHR)
export(MOSONST)
export(MRE4)
export(MRE4ABZ)
export(MRE4ALTE)
export(MRE4JL)
export(MRE4SONST)
export(MSOLZ)
export(MSONST)
export(MST56)
export(MVMT)
export(MVSP)
export(MZTABFB)
export(SolZ)
export(SozV)
export(UP56)
export(UPANTEIL)
export(UPEVP)
export(UPLSTLZZ)
export(UPMLST)
export(UPTAB14)
export(UPVKV)
export(UPVKVLZZ)
export(bedarfspruefung2)
export(leistungALGII2)
export(rating)
所以有人知道命名空间有什么问题吗?没有函数导出到包环境 - 当我在 install_github 和 library() 之后运行 KiSt() 时,我得到:Could not find function 'KiSt'
谢谢!
【问题讨论】:
-
如果在
R/*.R中使用<-而不是<<-进行函数定义等会发生什么?