Search code examples
rdocumentationpackageroxygen2

Exclude function from R package manual


I'm writing an R package, and I'm documenting all of my functions with roxygen2. However, I do not want all functions to appear in the manual of the package. How can I specify which functions should appear in the package manual, or which ones should not?

I am aware that naming a function with a leading dot, e.g. .f <- function() instead of f <- function() is a solution. Are there other solutions?


Solution

  • I had missed the following detail in the excellent book R packages by Hadley Wickham (in the section on object documentation):

    @keywords keyword1 keyword2 ... adds standardised keywords. Keywords are optional, but if present, must be taken from a predefined list found in file.path(R.home("doc"), "KEYWORDS").

    Generally, keywords are not that useful except for @keywords internal. Using the internal keyword removes the function from the package index and disables some of their automated tests. It’s common to use @keywords internal for functions that are of interest to other developers extending your package, but not most users.

    So adding @keywords internal to the roxygen2 function documentation results in the function not appearing in the package manual/index, while still making the help page be accessible after loading the package.