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?
-
12easiest way would be to delete the namespace file and let roxygen make it. if it exists, roxygen thinks that you made it yourself and won't fool with it – rawr May 08 '14 at 19:57
-
1Did you `@export` all 70 functions? – hadley May 08 '14 at 20:19
-
+rawr, I did try it, and it did not work. +hadley, I exported most functions (maybe only one isn't exported), and in Linux the NAMESPACE file is generated just fine. – gappy May 08 '14 at 20:32
-
is roxygen handling the namespace creation for your package? (build > configure build tools > generate documentation with roxygen > configure) – rawr May 08 '14 at 20:35
-
+rawr: yes I roxigenize prior to building. – gappy May 08 '14 at 20:41
-
I have the same problem. Was this ever resolved? – rcorty Aug 02 '16 at 15:52
1 Answers
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!

- 521
- 4
- 9