Code
library(tidycreel)
library(tidyverse)creel survey, fisheries, design-based inference, R, tidycreel, Quarto
Most chapters include runnable R code interleaved with the explanation. Code blocks show the call, and the output shown below each block is the actual result of running it against the book’s example data. Where a block builds on an earlier one, the objects it depends on were created earlier in the same chapter.
The book favors clarity over brevity: intermediate objects are usually named and inspected rather than chained into a single unbroken pipeline, so that each step in an analysis is visible and can be checked.
The examples use only two families of packages:
tidycreel — the companion package that provides the creel-specific design objects, estimators, diagnostics, and plotting helpers.dplyr, tidyr, ggplot2, purrr, stringr, forcats, lubridate, and here for general data manipulation and graphics.A typical chapter begins by loading these:
library(tidycreel)
library(tidyverse)No other packages are required to reproduce the analyses.
The running examples use a small set of example datasets — most prominently the Harlan Reservoir survey — distributed with the book in data/ or bundled with tidycreel. The datasets, their structure, and the assumptions behind them are described in the Data Notes appendix. Notation used across chapters is collected in Notation and Symbols.
Every estimate printed in this book was produced by the versions below, at the time the book was last rendered:
tidycreel: 7.0.0
R: R version 4.6.1 (2026-06-24)
These are read from the rendering session rather than written down, so they cannot fall out of step with the numbers on the page.
Reproducing a chapter under a different version of tidycreel may give different standard errors for the same data and the same point estimates. This is expected, and it is not a sign that something has gone wrong.
The package is under active development in exactly the area the book reports: how uncertainty is propagated from the quantities a survey measures into the quantities it reports. Two recent examples, both of which moved published numbers in this book:
In both cases the newer number is the correct one and the older number was understated. If your standard errors differ from the book’s, check your package version before looking for an error in your data.
3.4.0 made the same correction for a party-size estimate shared across sections, and changed the mixed case — an estimate that straddles the sections unevenly — from a quietly understated number to NA. No number previously published in this book moved, because until Section 13.1 was added the book used no sectioned designs. The behaviour is worth knowing about anyway: it is the one place where asking for a lake-wide standard error can correctly return nothing at all.
4.0.0 is the first release to move a point estimate in this book, and it moved one a long way. An aerial count is a raw observer count, and it needs two corrections that had no home in the package: a visibility correction for the anglers the observer missed, and an angler-to-people ratio for the people who were seen but were not fishing. Neither was applied, and neither could be stated. Section 11.2.3 now supplies both from Smucker et al. (2010), and the aerial effort estimate moved from 379 to 673 angler-hours while its 95% confidence interval widened from 314–443 to 367–979.
Both parts of that are the point. The estimate moved because two corrections that belong in the arithmetic were missing from it. The interval widened because those corrections are themselves estimated — from paired air-ground counts, with standard errors the source paper reports — and a correction treated as a known constant contributes no uncertainty at all. The old interval was not more precise; it was measuring less than it claimed to.
Point estimates are otherwise far more stable than standard errors across versions. When a release does change a point estimate, it is called out as a breaking change in the package’s NEWS file.
To run the examples locally, install tidycreel and the tidyverse, then work through a chapter top to bottom. Because later blocks depend on earlier ones, run a chapter’s code in order rather than in isolation. Details on how the book stays reproducible are in the Reproducibility appendix.
To install the exact version this book was rendered against rather than the current development state:
remotes::install_github("chrischizinski/tidycreel@v7.0.0")That version is read from the rendering session for the same reason the table above is, so it always names whatever produced the numbers on this page.
One caveat follows from that. Between releases the book may be built against a development version whose tag does not exist yet — the version number is claimed in DESCRIPTION as soon as work on it starts, while the tag is only cut when it ships. If the command above fails because the tag is not found, that is what has happened, and the fix is to install from the commit the book was built from rather than from the tag:
# Substitute the commit recorded in the Reproducibility appendix.
remotes::install_github("chrischizinski/tidycreel@<commit>")