3

This is my first time building an R package, and doing it with the help of devtools and roxygen2. After writing a simple func in the R directory and making a DESCRIPTION file with devtools, I try to build and reload for the first time but I get an error -

==> devtools::document(roclets=c('rd', 'collate', 'namespace'))

First time using roxygen2 4.0. Upgrading automatically...

Documentation completed

==> R CMD INSTALL --no-multiarch --with-keep.source TestPack

...

ERROR: a 'NAMESPACE' file is required

Which is odd because I have selected in my build configurations that roxygen2 should be making this for me. A man directory is made when building and reloading but nothing else.

5
  • 2
    just create a blank NAMESPACE file. on the command line e.g., touch NAMESPACE then rerun document()
    – sckott
    May 1, 2015 at 5:52
  • If your simple function does not require any imports and is not exported it may be that the file is not created. May 1, 2015 at 8:05
  • Thanks @ScottChamberlain I can make a blank NAMESPACE and then it works fine. I was thinking I didn't have to do that. May 1, 2015 at 12:21
  • yeah, i don't understand why that happens, i guess its conservative about making changes to your files, though i'd think if a namespace file didn't exist, it is a safe thing to create one
    – sckott
    May 1, 2015 at 16:55
  • Somehow, i had the same problem and I figured out that after a crash of my Rstudio, it had automatically unselected all the build options for roxygen2, that was the reason of the error.
    – agenis
    Apr 1, 2019 at 17:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.