4
votes

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?

1
Have you tried this? Can we see the package somewhere? - Vincent Bonhomme
In my opinion this is automatically added. Have you tried this? Use devtools::document("."). - J_F
@VincentBonhomme: I have tried this and it successfully builds a page that can be accessed via "?packageName". However, this does not solve our issue since it does not contain all functions (like the usual index page) and is not linked from all the subpages of the functions. The package is currently only an internal package for our company, so you can access it unfortunately. - Malte
@J_F: I have tried devtools::document("."), but produces the same result as document() - Malte

1 Answers

4
votes

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!