Search code examples
rpackagedevtoolsroxygen2rd

@title Missing name at line 1


I was getting this error when running devtools::document but had no idea how to troubleshoot. The file that popped up on my installed package when I entered ?MyPackage-package did not match the text in MyPackage-package.R at all. I initially suspected it might have been from adding the awesome citation functionality from RDpack, but this was not the culprit. How did I go about ultimately fixing the problem?


Solution

  • The error resulted from incorrect formatting in my PackageName-package.R file.

    I had heavily edited the file created by usethis::use_package_doc(), and added all of my roxygen comments Below the default content added by usethis. After looking at the documentation for merTools, I saw that it was ok to have the stuff I understand to be important for roxygen2 to make the .Rd files after and not before all the other roxygen comments.

    After moving the stuff created by usethis::use_package_doc() (and not just the NULL line; that was already at the end) to the bottom of the .R file, everything seemed to render fine and this error disappeared.