Inline package overview documentation using roxygen
Asked Answered
I

2

2

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.

Ideality answered 23/12, 2015 at 16:29 Comment(5)
You do need a NULL on the line following your documentation. See here for an example.Recreate
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.Bartizan
@slickrickulicious Agreed. Try also identical(NULL, {}) to see why both work equally well.Recreate
Updated title as well. I was trying to avoid comments on how to document for functions rather than the package as a whole.Ideality
Edit of original comment: Added curly braces around '\name' when I shouldn't have. After removing, it worked!Ideality
I
2

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.

Ideality answered 23/12, 2015 at 17:11 Comment(0)
S
0

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.

Schelling answered 27/7, 2022 at 19:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.