Conventions
This book uses a small set of visual conventions, and uses them the same way in every chapter.
Where you are
Each chapter opens with the same diagram of a reproducible analysis, with the stage the chapter teaches highlighted. The six stages along the top follow the order of work. The two bands beneath them apply to all six stages.
In code blocks
- Input lines carry no prefix.
- Output lines are prefixed with
#>. The whole block stays a valid R script: paste it into a console and it runs without error. - Numbered discs in the code gutter (1, 2, 3) are annotations. Hover or tap them to read the annotation, or read the numbered list below the block.
- Code shown but not run, such as shell commands that would change your machine, is said to be display-only where it appears.
A minimal example:
- 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; the glossary in the appendix defines it.
-
monospacemarks code, file paths, and package names. -
package::function()disambiguates function ownership when the package is not obvious from context. - Asides, history, and version notes are footnotes. They are shown in the margin of the web edition and at the foot of the page in print, so that the main text carries only what you need.
- ‘Habit 6’ and similar refer to the numbered habits in
Callouts
The book uses five kinds, so that each one means one thing.
A short question after a major section, with its answer folded inside. Try it before you open it: recalling an answer before reading it helps you retain the idea.
A command to run after a worked example that confirms it did what it claims. If the check fails, stop and find out why before going on.
A silent failure that analysts meet in practice: code that runs without error and produces a wrong answer.
A prompt for a language model or coding agent, placed beside the task it helps with, with the check that verifies what it returns. Send models structure, not data; Data governance and agent safety says why.
A short flag where a technical step can harm the people in the data or mislead a reader, pointing to the fuller treatment in 32 Ethics Beyond Compliance.
Exercise solutions sit in folded blocks titled ‘Solution’ directly beneath each exercise. The printed edition cannot fold blocks. There, Check answers and solutions are collected at the end of each chapter instead, so that you can attempt a question before you see its answer.