问题
I'm trying to create an R package but I keep getting the error:
Error in namespaceExport(ns, exports) :
undefined exports: MCLE, defineFunctions, naiveMLE
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:
R: Error in namespaceExport(ns, exports) : undefined exports:
Error in namespaceExport(ns, exports) : undefined exports: ... Error: package or namespace load failed
What does "Error in namespaceExport(ns, exports) : undefined exports" mean?
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).
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!
回答1:
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.
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$
.
You can easily exclude files and/or directory by using devtools::use_build_ignore("file/dir you want to ignore")
.
Hope this helped
I'd like to thank @hadley for his kind and neat support
来源:https://stackoverflow.com/questions/35424683/r-cmd-check-fails-with-undefined-exports