Conventions
This book uses a small set of visual conventions, which we summarize here for the reader’s reference.
In code blocks
- Input lines carry no prefix.
- Output lines are prefixed with
#>. The whole block therefore remains a valid R script, so that it runs without error when pasted into a console. - Numbered discs in the code gutter (1, 2, 3) are annotations. The reader may hover over or tap them to read the annotation, or may read the numbered list below the block.
A minimal example:
library(dplyr)
penguins |>
filter(!is.na(body_mass_g)) |>
group_by(species) |>
summarise(mean_mass = mean(body_mass_g))- 1
-
Start the pipeline with the
penguinsdata frame. - 2
- Drop rows with missing body-mass values.
- 3
- Compute the species-level mean body mass.
In prose
- Bold marks a term on its first use.
monospacemarks code, file paths, and package names.package::function()disambiguates function ownership when the package is not obvious from context.
Callouts
Clarification that is useful but not essential on first read.
A concrete check the reader should run. This is the book’s signature callout, and it appears after every non-trivial example.
A failure mode reported by past students of the course.
An adversarial prompt for use with a language model, paired with an explicit verification step.
Mathematical notation
We use conventional notation throughout. Vectors are bold lower-case (\(\mathbf{x}\)); matrices are bold upper-case (\(\mathbf{X}\)); scalars and parameters are non-bold. Estimators carry hats (\(\hat\theta\)). Sample size is \(n\); parameter dimension is \(p\).