问题
I have a package that builds successfully and without warnings under ubuntu 12.04. The package is pure R, and has approximately 70 functions (approx 2000 LOCs). When I try to build under Windows 7 in Rstudio, the package builds successfully (no warnings) but NAMESPACE contains export() for only a dozen functions. First time it happens to me, probably because I rarely use Windows. This happens under 3.1 and the latest version of Rstudio and roxygen2. Has it happened to any of you? What could be the cause of this?
回答1:
I have no idea if it's linked with your problem (which I hope have been solved since then...), but I just had a similar problem, and it turns out it was because of bad interactions with my clumsy naming conventions.
Typically, I wrote functions named plot.XXX()
, where XXX
describes what should be drawn. Roxygen interpreted them as generic function definitions for the S3 object system. XXX
was then considered as a (non exported) class with a plot()
function, and wrote the NAMESPACE file accordingly, which was not what I expected, of course. I suppose the same would happen for str.XXX()
, summary.XXX()
, etc., or for XXX.data.frame()
, etc. I didn't have any of those, but it would make sense if it did.
In order to fix the problem, I just replaced my dots with underscores in the function names... and discovered a new world of possibilities with S3/S4/S5!
来源:https://stackoverflow.com/questions/23551138/roxygen2-not-generating-namespace-correctly