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.
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.