This document describes how to update the documentation that supports the package, including R help pages, dataset documentation, articles, app help materials, and the pkgdown website.
Updating package documentation
The R package is documented in web pages and in standard R help files viewable in RStudio. Documentation generally needs to be updated before a new package release. Updates may be needed in the following places:
Datasets: reference docs explaining the datasets (in EJAM/R/data_*.R files)
Articles: vignettes helping R users with the package (in
EJAM/vignettes/*.Rmd)User Guide: help for people using the web app (in
EJAM/inst/app/www/as a PDF file)Website: web pages providing all of the above in HTML format, via the pkgdown package
Each is explained below:
Package: overall package-wide information and documents
Package-wide documentation files can be edited directly and include the following:
DESCRIPTION,README.Rmd(for the README, editREADME.Rmd, not the generatedREADME.mdfile),R/EJAM-package.R(for?EJAM-package),NEWS.mdused to make NEWS,CONTRIBUTING.mdused to make CONTRIBUTING, LICENSE based oninst/LICENSE.md, CITATION based oninst/CITATION, CITATION.cff, and others.Some of these are used by and shown by the GitHub repository, notably the
README.mdthat is generated from theREADME.Rmdfile and appears on the GitHub repository as README and in the pkgdown site as README, and theDESCRIPTIONfile that stores the package version number, repository URLs, and related package metadata.
Functions: reference docs explaining the R functions
roxygen2 package tags define the documentation in the
R/*.Rfiles that contain the source code and documentation of functions and datasets.While many functions or objects have their own
.Rfiles, some.Rfiles contain code and documentation for multiple functions, so not every function has a file of its own.Some utility/helper functions, mostly not exported, are stored in files prefixed with
utils_, such asR/utils_indexblocks.Rdocumentingindexblocks()(but not all helper functions are in files named that way).It can be useful to check generated help files with
tools::checkDocFiles(".")after runningroxygen2::roxygenise().
Datasets: reference docs explaining the datasets
All datasets are documented in files named with a prefix of
data_, such asR/data_blockgroupstats.Rwhich documents the?blockgroupstatsdataset.Most dataset documentation is created or updated alongside the code that creates or updates those datasets. For annual EJScreen-style datasets, use the staged pipeline described in Updating EJScreen Datasets Annually (via the Pipeline). For other package datasets, see Updating and Managing the Datasets Used by EJAM and the relevant
data-raw/datacreate_*.Rscripts.Many
R/*.Rfiles for datasets are created automatically, not edited by hand, through thedataset_documenter()function as used in the scripts withindata-raw/datacreate_*.R, while others are updated by editing the.Rfile directly.
Articles: vignettes helping R users with the package
Articles (called vignettes here) are written and edited as
.Rmdfiles in thevignettesfolder. Edit the.Rmdsource file, not the generated HTML article.Preview one article after editing it, before rebuilding the whole site:
EJAM:::pkgdown_preview_article("installing")
EJAM:::pkgdown_preview_article("vignettes/dev-update-documentation.Rmd")These preview helpers build into a temporary folder by default, so they do not publish anything and do not require committing generated HTML. They also try to use the Pandoc bundled with RStudio if a terminal R session cannot find Pandoc on its own.
- New articles or renamed files also require edits to
_pkgdown.yml.
User Guide: help for people using the web app
- If you change the UI, new screenshots may be needed for a new version of the User Guide. The User Guide has historically been stored as a PDF document built from a Word document.
Spell-checking package-wide
- To run a spell check and review terms flagged as possible problems:
x <- spelling::spell_check_package()
x <- data.frame(
frq = sapply(x$found, function(z) {length(unlist(z))}),
word = x$word)
x <- x[order(x$frq), ]
rownames(x) <- NULL
xThen use Ctrl-Shift-F to search all files for a flagged term and check whether it is actually a problem.
To update
inst/WORDLIST, the list of words ignored by spell checking:
# 1. Add obvious dataset names documented to the WORDLIST
datanames = gsub('\\.R$', '', gsub('^data_', '', dir('./R', pattern = '^data_.*R')))
datanames = datanames[!grepl('aaaaaaaaaaaaa|xxxxxxxxxx', datanames)]
# 2. Add names of functions to the WORDLIST
funcnames = EJAM:::pkg_functions_and_data( 'EJAM' )$object
wordlist = readLines('inst/WORDLIST')
wordlist = sort(unique(union(wordlist, c(datanames, funcnames))))
# Write the revised list of words to the file
writeLines(wordlist, 'inst/WORDLIST')Website: web pages providing all of the above in HTML format
The web-based documentation pages are built from source files by
pkgdown and published by GitHub Actions. The public site
should be served from the root of the gh-pages branch.
Source branches such as main, development, and
release branches should not publish from main/docs and
should not commit generated docs/ HTML.
In normal documentation work, edit and commit source files such as
.R, .Rmd, README.Rmd,
NEWS.md, DESCRIPTION, man/*.Rd
inputs generated from roxygen comments, and _pkgdown.yml.
Do not edit docs/ or the gh-pages branch by
hand; those are generated deployment outputs.
Normal workflow for a vignette edit
Edit the relevant
.Rmdfile invignettes/.Preview just that article:
EJAM:::pkgdown_preview_article("installing")If the article is new, renamed, removed, or moved in the navigation, update
_pkgdown.yml.Commit and push the source files only. Do not add generated
docs/files.Let GitHub Actions build and publish the public site after the source branch is pushed or merged into the branch that controls the desired documentation version.
The first step in updating those web pages is updating the YAML file. The web-based documentation pages are organized by a file called
_pkgdown.yml– seeusethis::edit_pkgdown_config()– which specifies the contents of the documentation web pages, such as the names of any vignette files to be shown in the list of articles, which functions are included in the reference pages index, and related settings. Any new, removed, or renamed functions, vignettes, datasets, or changes in what is exported may require edits to_pkgdown.yml.For local checks,
EJAM:::pkgdown_update()is still available as a maintainer utility. Treat it as a local preview/check workflow, not the publishing workflow. It can still be useful when you want broader local checks around roxygen documentation, README rendering, pkgdown site structure, or stale.Rdfiles.For a faster local site preview without publishing:
EJAM:::pkgdown_preview_site()
EJAM:::pkgdown_preview_site(pkgdown_dev_mode = "devel")Public publishing is handled by
.github/workflows/pkgdown.yaml. GitHub Pages should be configured to publish from the root of thegh-pagesbranch. The workflow builds the site in a runner and deploys generated HTML togh-pages.-
The normal publishing paths are:
-
mainbuilds the current release documentation at the site root. -
developmentbuilds development documentation underdev/. - version tags and GitHub releases build historical documentation
under the tag name, such as
v3/. - manual workflow dispatch can build a chosen ref into a chosen folder.
-
The workflow file must exist on the branch that GitHub Actions uses for the event being triggered. For normal public updates, make sure the workflow change has reached the default branch before expecting future
mainpushes to rebuild the root documentation site.To publish historical docs for an older release, use a tag or release such as
v3and deploy it to the same folder name. The resulting URLs should look like:
https://public-environmental-data-partners.github.io/EJAM/
https://public-environmental-data-partners.github.io/EJAM/dev/
https://public-environmental-data-partners.github.io/EJAM/v3/The documentation is created and updated using the roxygen2 and pkgdown R packages, which read information from the
.Rfiles in the R folder, from.Rmdfile vignettes (also called articles) in thevignettesfolder, and from_pkgdown.yml. roxygen2 creates.Rdfiles inman/; pkgdown creates HTML files for GitHub Pages.The URL where documentation is published at any given time should be recorded in the
URLfield of theDESCRIPTIONfile in the source package root. That URL can be read withEJAM::url_package("docs"), which currently returns https://public-environmental-data-partners.github.io/EJAM. Prior to mid-2025, documentation web pages had been on GitHub Pages at URLs related to theUSEPA/EJAMandUSEPA/EJAM-openrepositories, but those pages may now be archived, unpublished, or otherwise obsolete.