Inline package overview documentation using roxygen

232 Views Asked by At

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.

2

There are 2 best solutions below

0
Joel Graff On BEST ANSWER

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.

0
Jacob Helwig On

I made my package (called pkgName) using devtools and already had a file named pkgName_package.R that was automatically generated. It contained the following lines:

#' @keywords internal
#' @aliases pkgName-package
"_PACKAGE"

After removing the first line, @keywords internal, and rebuilding, pkgName-package was a documented topic that appeared at the top of the reference manual.