Malte
Malte

Reputation: 955

Create main help page (index) for R package using devtools

I am building a R package using devtools. All documentation is built using roxygen2. For the functions this works all fine, but how can I provide a help page for the whole package, that lists all the available functions.

In other packages there's always a link in the bottom of each help page which leads to the index page:

Screenshot from dplyr package (exemplary index link)

How can I built/link this index page with devtools?

EDIT: If I access a help page by "?functionName", there will be also the following output printed to the console "Using development documentation for functionName". From the github repository of devtools I find the function dev-help.R that gives this output. In its comments it's stated that links won't work with this development help.

Note that this only renders a single documentation file, so that links to other files within the package won't work.

So how can I use the normal documentation instead of dev-help?

Upvotes: 5

Views: 2350

Answers (1)

Malte
Malte

Reputation: 955

Found the solution. If you have the following workflow:

  1. create()
  2. document()
  3. build()
  4. install.packages()
  5. library(<pkg-name>)

the documentation will be loaded in the namespace of R during document(). Accordingly, a later call of ?functionName will refer to the development stage of the documentation and not the one provided by the compiled package.

Thus, creating a fresh R session after installation just solves the issue!

Upvotes: 6

Related Questions