This reference overwrites the default Reference of pkgdown. It is a vignette stored in vignettes/siteonly. The _pkgdown.yml file contains this header:

navbar:
  type: default
  left:
  - text: "Reference"
    href: articles/siteonly/reference.html

You can see pkgdoc in action here.


Let’s build references with pkgdoc, manipulate data with dplyr, and build tables with knitr and DT.

library(pkgdoc)
library(dplyr)
library(knitr)
library(DT)

All functions in pkgdoc

Let’s see what documentation we have to decide the best way to present it.

The functions are few and we can show them all at once. But let’s tweak the output:

  • Let’s emphasize the main functions by pushing the helper function to the bottom.
  • Let’s hide the concept column.
  • Let’s build transform the ugly text in topic and package into links.

(The column package isn’t helpful but I’ll leave it to show the link.)

docs %>% 
  arrange(desc(concept)) %>% 
  select(-concept) %>% 
  knitr::kable()
topic alias title package
? reference_package, reference_concept Pick documentation matching some concepts or package names. pkgdoc
? search_docs Dataframe the documentation of installed packages. pkgdoc
? s3_strip_class Strip the class part of attached S3 methods (do nothing with other functions). pkgdoc

Okay, but pkgdown does that already. To see the value of pkgdoc let’s explore a more complex example.

Example: Referencing documentation across multiple packages

To show how to reference documentation across multiple packages we will use the fgeo meta-package fgeo.

Searching

You can reference a large number of documentation. Instead of scanning a long list your readers may prefer to search.

Scanning

If the list isn’t too long, your reader may scan the entire list. Sometimes it is nice to know you have seen it all.

Grouping multiple packages

You may cherry-pick all documentation from specific packages.

reference_package(
  c("fgeo.x", "fgeo.analyze"), 
  url = fgeo_url
 ) %>% 
  arrange(concept) %>% 
  select(-package, -concept) %>% 
  knitr::kable()
topic alias title
? datasets, elevation, habitat, stem5, stem6, tree5, tree6, vft_4quad, tree6_3species Access data via ‘library(fgeo.x)’ or ‘fgeo.x::’.
? download_data Access data stored online.
? example_path Access data stored in system files.
? recruitment_ctfs, mortality_ctfs, growth_ctfs Recruitment, mortality, and growth.
? abundance_byyr, basal_area_byyr Create tables of abundance and basal area by year.
? abundance, basal_area Abundance and basal area, optionally by groups.
? recruitment_ctfs, mortality_ctfs, growth_ctfs Recruitment, mortality, and growth.
? recruitment_ctfs, mortality_ctfs, growth_ctfs Recruitment, mortality, and growth.
? fgeo_habitat Create habitat data from measures of topography.
? fgeo_topography Create topography data: convexity, slope, and mean elevation.
? fgeo_habitat Create habitat data from measures of topography.
? fgeo_topography Create topography data: convexity, slope, and mean elevation.
? tt_test Torus Translation Test to determine habitat associations of tree species.
? summary Summary of ‘tt_test()’ results.

Grouping concepts from multiple packages

You may cherry-pick all documentation matching some concept. Create topics by adding the tag @family in your documentation (see roxygen2).

topic alias title
? fgeo_elevation Create elevation data.
? fgeo_habitat Create habitat data from measures of topography.
? fgeo_topography Create topography data: convexity, slope, and mean elevation.
? tt_test Torus Translation Test to determine habitat associations of tree species.
? autoplot Plot habitats.
? autoplot Plot species distribution and/or topography.
? autoplot_by_species List plots of species distribution and topography (good for pdf output).
? elev Allow autoplotting the column ‘elev’.
? plot_dbh_bubbles_by_quadrat List dbh bubble-plots by quadrat (good for .pdf output).
? plot_tag_status_by_subquadrat List plots of tree-tag status by subquadrat (good for .pdf output).
? sp Allow autoplotting the column ‘sp’.
? sp_elev Allow autoplotting the columns ‘sp’ and ‘elev’.