Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add sections to R package's help/documentation

Some R packages (e.g., ggplot2, dplyr,devtools etc.) have alphabetically entitled sections in their help/documentation and a bar of links to those sections (indicated by red arrows in picture below). Other packages (e.g., RcmdrMisc) don't have.

How can I add these elements to may R package's help?

ggplot2 help

I use roxygen2 for documentation.

like image 400
GegznaV Avatar asked Feb 27 '16 15:02

GegznaV


2 Answers

In the Writing R Extensions file (included with every copy of R from CRAN) is a small section regarding the INDEX file:

1.1.4 The INDEX file

The optional file INDEX contains a line for each sufficiently interesting object in the package, giving its name and a description (functions such as print methods not usually called explicitly might not be included). Normally this file is missing and the corresponding information is automatically generated from the documentation sources (using tools::Rdindex()) when installing from source.

When packages have an index file, the HTML code is in the html folder.

like image 76
IRTFM Avatar answered Sep 20 '22 19:09

IRTFM


The help index page is automatically generated by R when you install a package. But note that the alphabetical index is only generated when there are more than 100 items on the index page. There is currently no way to change that behavior. I found that in the code for installing packages

like image 44
MrFlick Avatar answered Sep 21 '22 19:09

MrFlick