1  Reproducible Reports

Why this playbook uses code, and what you will have made by the end

Authors

Shane McCarty

Zihan Hei

Published

10.05.2026

Abstract

This is the first chapter on purpose. Before researchers install anything or write any code, they see where they are headed: a finished report in which every plot and every number was made by code. The chapter explains why reproducibility matters (the replication crisis and the four problems behind it), compares pointing and clicking in SPSS with writing code in R, surveys the software researchers use (R, Python, SPSS, SAS, Stata) and why this playbook uses R and Quarto, and shows example reports from earlier FRI Public Health cohorts, including the RD Report and Final Report that researchers in this course will produce.

Keywords

reproducibility, replication crisis, R, Quarto, example reports

GoGo: Start here

This is the first chapter on purpose. Before you install anything or write any code, look at where you are headed: a finished report in which every plot and every number was made by code. In the next chapter, Coding a Plot, you will run some code yourself, right in your browser.

1.1 Why Reproducibility Matters

Science is supposed to correct itself: if a finding is real, other researchers should be able to repeat the study and find it again. In the 2010s, researchers tested that promise, and many well-known findings failed. In the largest project, 270 researchers repeated 100 published psychology studies, and fewer than half of them produced the same result a second time (Open Science Collaboration, 2015). Similar problems were found in medicine, economics, and other fields. This is called the replication crisis (or reproducibility crisis).

A Nature paper by Baker (2016) states: “More than 70% of researchers have tried and failed to reproduce another scientist’s experiments, and more than half have failed to reproduce their own experiments.”

In Science Fictions, the psychologist Stuart Ritchie (2020) argues that four problems are behind it: fraud (making up data), bias (publishing only the results that “worked”), negligence (honest mistakes, such as a typo in a spreadsheet or a number copied incorrectly into a paper), and hype (claiming more than the results show). Most researchers will never commit fraud. Negligence is different: anyone can copy the wrong number into a table, forget which version of the data they used, or lose track of how a variable was cleaned.

A reproducible report is your protection against negligence. To see why, you need to know that there are two ways to tell statistical software what to do.

  • Point and click. Some statistical programs, such as the widely-used SPSS software, work like most apps you already use. You open your data, choose an analysis from a drop-down menu (for example, Analyze > Compare Means), check a few boxes, and click OK. The result appears in a window. It feels easy, but when you close the program, there is no record of what you clicked. It is like giving directions by pointing: it works in the moment, and nobody can follow it later.
  • Code. In other programs, such as R, you type your instructions as text, one line at a time, and save them in a file. It is like writing the directions down: anyone can follow them again, step by step, and get to the same place.

Now compare the two ways of getting a result into a paper:

Point and click in SPSS, then copy and paste into a doc Code in R to produce a reproducible report
How the result is made You click through menus. Nothing records which options you chose. Every step is written down as a line of code.
How it gets into your paper You copy numbers and paste plots into a Word document by hand. The code makes the plot, table, or number inside the report itself.
When the data change You redo every click and every paste, and hope you miss nothing. You run the report again. Everything updates.
When someone checks your work They have to trust you. They run your file and get the same results.

That is the primary objective of this playbook: to make community health research more reproducible. You will write your analysis line by line in R, and you will publish it with Quarto, where the code, the results, and your writing live in one .qmd file. Anyone who has your data file and your .qmd file can run the report and get the same results, including you, six months from now.

Doing this takes the right kind of software, which is the subject of the next section.

1.2 Software for Reproducibility

Researchers analyze data with many different programs. The column on the right of the table above (code in a reproducible report) is only possible with some of them. The programs differ in three ways that matter for reproducibility: whether the analysis is written down as code, whether the software is free and open source, and the disciplines and fields that use it (which affects how easy it is to find help, and whether someone else can run your analysis).

Software How you work License Cost Disciplines and fields
R Code Open source Free Statistics, public health, social sciences
Python Code Open source Free Data science, computer science, engineering
SPSS Mostly menus Commercial Paid Psychology, social sciences
SAS Code Commercial Paid Biostatistics, clinical trials, government statistics
Stata Code and menus Commercial Paid Economics, epidemiology, policy research

Why this playbook uses R:

  • It is code. Every step of your analysis is written down, so it can be checked, repeated, and fixed. A series of clicks in a menu leaves no record.
  • It is free and open source. You can install it on any computer, and you will still have it after you graduate. Anyone who wants to check your work can run it, too, without buying a license.
  • It is widely used. A large community means free books, free courses, and an answer online for almost every error message.
  • It was built for statistics and graphics, and with Quarto, your code, results, and writing live in one reproducible report.

1.3 Reproducible Reports

Students on the quantitative and mixed-methods data analysis tracks will produce a reproducible Quarto Markdown report for your individual report. You will learn how to start your own Quarto report later, in Start a Report. Right now, you do not need any software. Peruse a range of individual and team manuscripts that were published as Quarto reports.

1.3.1 Quarto Examples

Quarto provided two examples of a reproducible report and manuscript:

1.3.2 FRI-PH Cohort 11 Examples

FRI-PH Cohort 11 produced individual reports and a team manuscript. Cohort 12 will ONLY produce an individual report. Below are examples of individual reports from students:

1.3.3 FRI-PH Lab Examples

The FRI Public Health Lab has produced Quarto manuscripts from active research projects:

References

Baker, M. (2016). 1,500 scientists lift the lid on reproducibility. Nature, 533, 452–454. https://doi.org/10.1038/533452a

Open Science Collaboration. (2015). Estimating the reproducibility of psychological science. Science, 349(6251), aac4716. https://doi.org/10.1126/science.aac4716

Ritchie, S. (2020). Science fictions: How fraud, bias, negligence, and hype undermine the search for truth. Metropolitan Books.