【问题标题】:R: Error in namespaceExport(ns, exports) : undefined exports:R:namespaceExport(ns,exports)中的错误:未定义的导出:
【发布时间】: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_githublibrary() 之后运行 KiSt() 时,我得到:Could not find function 'KiSt'

谢谢!

【问题讨论】:

  • 如果在R/*.R 中使用<- 而不是<<- 进行函数定义等会发生什么?

标签: r github rstudio


【解决方案1】:

使用<<- 定义函数时出现错误。感谢@kohske 的提示!

【讨论】:

    猜你喜欢
    • 2014-10-14
    • 2014-12-29
    • 2016-09-27
    • 2021-01-03
    • 1970-01-01
    • 2020-10-14
    • 1970-01-01
    • 2021-12-28
    • 2017-11-01
    相关资源
    最近更新 更多