Reproducible quantitative research with R
A useful R workflow makes inputs, transformations, models, diagnostics, outputs, and environment assumptions inspectable.
A useful R workflow makes inputs, transformations, models, diagnostics, outputs, and environment assumptions inspectable.
Separate source data from derived data
Scripts should create analysis-ready objects from documented inputs rather than relying on manual edits that cannot be audited.
Encode decisions close to the analysis
Meaningful variable names, functions, comments, tests, and decision logs make assumptions easier to review than a long sequence of opaque commands.
Generate reported outputs from final code
Tables and figures should be produced from the same final objects used for inference, with package and environment information recorded where needed.
Failure modes to check
- Choosing a method because it is familiar rather than because it matches the estimand and data structure.
- Treating assumptions as a generic pass/fail checklist instead of evidence about a specific model.
- Changing the workflow after seeing results without recording the decision or its effect on uncertainty.
- Reporting software output without tracing the claim to final code, diagnostics, and limitations.
Continue the decision path
Explore the related statistical consulting service, or discuss the decision in your own study.
Related decision guides
- How to audit a statistical analysis before reporting it
- What to check before reporting AI-generated statistics
Methodological note
This guide provides general educational information. The appropriate decision depends on the study question, design, data, evidence, ethics, and institutional requirements.