Skip to content

Update documentation in package and on GitLab - #256

Merged
aappling-usgs merged 9 commits into
mainfrom
pkgdown
Oct 8, 2026
Merged

aappling-usgs merged 9 commits into
mainfrom
pkgdown

Conversation

@aappling-usgs

@aappling-usgs aappling-usgs commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

This PR is focused on getting the loadflex documentation updated (e.g., new URLs) and back on GitHub pages (now using pkgdown).

This PR includes a preview of the restored github.io pages for this package, which have been down for years! See https://doi-usgs.github.io/loadflex/preview/pr256/ for the preview while this PR is still open, and after merge we should see the pages at https://doi-usgs.github.io/loadflex.

@gfkltn, would you be able to provide the administrative review? On top of the previous two, this PR gets us to a much more functional state than we were last week, including smoother installation, fewer runtime errors/warnings, and updated documentation within the package and on the web - thank you for the prod, and I hope it's useful for you and your students.

What I did for this PR:

  • Removed old files for documentation methods we don't use anymore (committing inst/doc) and continuous integration methods we don't use anymore (travis and appveyor). Re-implementing continuous integration with GitHub actions is a PR for another day.
  • Update README and the package startup message to make them a little tidier and more 2026 (e.g., using current URLs)
  • Add Remotes: to the DESCRIPTION so that devtools::build_readme() and other autobuild tools know where to find the custom USGS packages. Run devtools::build_readme() to align README.md to the current README.Rmd
  • Create a limited-scope GITLAB_PAT so that devtools::build_readme() could install from the specified remotes; also installed that PAT for GitHub actions use in the DOI-USGS/loadflex repo: Settings → Secrets and variables → Actions → "New repository secret."
  • Update .gitignore and .Rbuildignore based on Claude's advice (which makes sense to me)
  • Run devtools::document(), debug to eliminate warnings, run again. This modifies a bunch of man/*.rd pages, though it's mostly just white space changes
  • Run usethis::use_pkgdown() and usethis::use_pkgdown_github_pages()
  • Add three workflows for GitHub actions (in the .github/workflows dir) that should cause pkgdown to build the site pages once I open this PR, in a preview branch, and then build them again for the main branch once this PR is closed.
  • Adjust for a rloadest segfault on GitLab - see also censReg_AMLE segfault on GitHub CI #257 for thoughts on the longer-term fix, but in the meantime, I've built the vignette locally to be able to include it in the pkgdown site at https://doi-usgs.github.io/loadflex/preview/pr256/.

I worked with DOI-Claude on this all day, asking for explanations and GitHub workflow code. I did a fair amount of the actual code editing myself everywhere else in the package, following Claude's advice and logic. I considered every suggestion first, ran tests, and paid attention to test output.

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

📖 pkgdown preview for this PR: https://doi-usgs.github.io/loadflex/preview/pr256/

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In line 25, do you want to point to the new WDFN page (https://waterdata.usgs.gov/monitoring-location/USGS-01073500)?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure do, thanks!

@gfkltn gfkltn Oct 8, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In line 121 ... "flux" is a rate of transport by definition, so saying "flux rate" is redundant. That being said, a lot of people don't understand what flux is, so it may not hurt to be redundant.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof, good point, that's redundant. In fact, Wikipedia defines flux as a rate per unit area, so the flux/load units we use across loadflex and rloadest are also treating area implicitly (there's a hidden per-cross-section-area).

I don't want to change the column name right away because I'll need to think about what the right switch is and how to support users who may have workflows expecting the current naming scheme, but I could do that in the future.

In the meantime, I've added an explanation of the current naming scheme and an example of how to see what units are being reported:

The loadflex process for aggregation of point predictions (to monthly, annual, etc.)
has changed since we published our 2015 manuscript.
aggregateSolute from that manuscript is no longer exported as a function in loadflex.
Instead, you can use the agg.by argument to predictSolute to
generate predictions at the time interval of interest.
You can aggregate for for months, water years, calendar years, or other time intervals,
and for mean concentration (named conc in the output)
or flux (flux.rate in the output, using "rate" to remind users that the time denominator
does not change regardless of the time period being aggregated over).
Standard errors (se.fit and se.pred) are available for loadReg2 models.
The units of the aggregated output are what you passed into each model as metadata.
count reports the number of observations going into the aggregated estimate in each row.
Some examples:

getUnits(getMetadata(no3_lr), 'conc')
agg_c_li <- predictSolute(no3_li, "conc", newdata=estdat, agg.by="month")
agg_c_lm <- predictSolute(no3_lm, "conc", newdata=estdat, agg.by="water year")
agg_c_lr <- predictSolute(no3_lr, "conc", newdata=estdat, agg.by="unit", se.fit=TRUE, se.pred=TRUE)
agg_c_lc <- predictSolute(no3_lc, "conc", newdata=estdat, agg.by="day")

getUnits(getMetadata(no3_lr), 'flux rate')
agg_f_li <- predictSolute(no3_li, "flux", newdata=estdat, agg.by="month")
agg_f_lm <- predictSolute(no3_lm, "flux", newdata=estdat, agg.by="water year")
agg_f_lr <- predictSolute(no3_lr, "flux", newdata=estdat, agg.by="calendar year", se.fit=TRUE, se.pred=TRUE)
agg_f_lc <- predictSolute(no3_lc, "flux", newdata=estdat, agg.by="day")

@gfkltn gfkltn left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added two comments, neither of which are critical. I saw no issues from an administrative review standpoint.

@aappling-usgs
aappling-usgs merged commit 86a18c8 into main Oct 8, 2026
1 check passed
github-actions Bot pushed a commit that referenced this pull request Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants