2
votes

I imagine this is a simple thing that I keep overlooking in the documentation, but I can't seem to figure out how to get package-level documentation to work in R. I'm not referring to function or class-specific documentation, but the documentation that you get when you type, for example, ?stats.

I've followed the general instructions I've found on the web, creating a sckeleton documentation file saved as .R. The .R file is copied with the package scripts, but the help documentation doesn't get made into a .Rd file (unless I add a function definition also named after the package).

An example of what I've tried:

#'_PACKAGE
#'MyPackage
#'
#'MyPackage description
#'
#'MyPackage details
#'@alias{MyPackage}
#'@alias{MyPackage-package}

I'm having a hard time finding good examples of how to set up general package documentation, for some reason. I've written quite a few function help files, and I know my package help file is being found by roxygen, but it's unclear why I can't generate an .Rd from it.

1
You do need a NULL on the line following your documentation. See here for an example. - Josh O'Brien
You may want to alter the title of your question. This is not a 'overall package documentation'. You know how to do this in a Rd file -- this is about a specific aspect of roxygen2. - Dirk Eddelbuettel
@slickrickulicious Agreed. Try also identical(NULL, {}) to see why both work equally well. - Josh O'Brien
Updated title as well. I was trying to avoid comments on how to document for functions rather than the package as a whole. - Joel Graff
Edit of original comment: Added curly braces around '\name' when I shouldn't have. After removing, it worked! - Joel Graff

1 Answers

1
votes

Answer courtesy of @slickrickulicious in the comments above:

I needed to add NULL at the end of my documentation file and include '@name MyPackage'. Doing so generated the package help file correctly.