Build a reproducible R analysis with targets
8 steps · about 4 h 25 min · Intermediate
- Build a first targets pipeline (guide, The targets R package user manual, 40 min)
A small working graph introduces targets, commands and dependency-aware execution together.
- Move analysis steps into functions (guide, The targets R package user manual, 35 min)
Pure focused functions make dependencies visible and individual steps testable.
- Declare package dependencies (guide, The targets R package user manual, 25 min)
Workers must load the same packages explicitly rather than inherit an interactive session.
- Branch over changing groups of work (guide, The targets R package user manual, 40 min)
Dynamic branching scales repeated analysis while preserving each branch in the dependency graph.
- Track files as pipeline inputs and outputs (guide, The targets R package user manual, 30 min)
File targets invalidate downstream work when external data or generated artifacts change.
- Diagnose a failed target (guide, The targets R package user manual, 30 min)
Saved workspaces and metadata make a failure reproducible outside the full run.
- Record the package environment with renv (guide, renv documentation, 35 min)
A lockfile preserves the package versions that gave the pipeline its behaviour.
- Render the final report predictably (guide, Quarto documentation, 30 min)
Explicit execution options keep reporting separate from hidden notebook state.