R CMD检查失败,并显示“未定义的导出". [英] R CMD check fails with "undefined exports"

查看:146
本文介绍了R CMD检查失败,并显示“未定义的导出".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建R包,但我不断收到错误消息:

I'm trying to create an R package but I keep getting the error:

Error in namespaceExport(ns, exports) : 
  undefined exports: MCLE, defineFunctions, naiveMLE

在我的程序包上运行R CMD check时.我正在使用roxygen2,错误消息中列出的三个功能是带有@export标记的三个功能.我已经检查了堆栈溢出的类似问题/解决方案:

when running R CMD check on my package. I'm using roxygen2, and the three functions listed in the error message are the three with @export tags. I've checked similar problems/solutions on stack overflow:

namespaceExport中的错误(ns,导出) :未定义的导出:...错误:程序包或名称空间加载失败

"namespaceExport中的错误( ns,出口):未定义的出口"是什么意思?

,但是这些似乎都不能解决我的问题(我没有使用<<-,我没有使用通用帮助页面导出任何函数,并且ggplot2或其他R包也没有问题.在CRAN上).

but none of these seem to resolve my problem (I'm not using <<-, I don't export any functions with a common help page, and the issue isn't with ggplot2 or a different R package on CRAN).

删除NAMESPACE文件后,我已经构建了软件包,并且构建成功.我还确认该软件包具有列为未定义"的功能,并且我不知道还要检查什么!

I've built the package after deleting the NAMESPACE file, and it built successfully. I've also confirmed that the package has the functions listed as "undefined," and I don't know what else to check!

推荐答案

我有一个非常相似的问题.您是否检查过.Rbuildignore文件? 它可能与要导出的函数与正则表达式匹配有关.

I had a very similar problem. Did you check your .Rbuildignore file? It could be related to regular expression matches with the functions you want to export.

我试图通过将名称放入.Rbuildignore来从构建目录中排除"HTLM_downloads"目录.不幸的是,这不起作用,因为它会忽略每个包含单词"html"(HTML)的文件. @export甚至都不能解决问题.我需要通过放置^HTML_downloads$来锚定表达式.

I was trying to exclude from the build the directory "HTLM_downloads" by putting the name inside .Rbuildignore. Unfortunately this does not work since it ignores every file containing the word "html" (HTML). Not even an @export solved the problem. I needed to anchor the expression by putting ^HTML_downloads$.

您可以使用devtools::use_build_ignore("file/dir you want to ignore")轻松排除文件和/或目录.

You can easily exclude files and/or directory by using devtools::use_build_ignore("file/dir you want to ignore").

希望这对您有帮助

我要感谢@hadley的友善和整洁的支持

I'd like to thank @hadley for his kind and neat support

这篇关于R CMD检查失败,并显示“未定义的导出".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆