3. Reproducible Science

This section includes background on:

Motivating scenario: You are conducting a scientific research project and want to make sure that your project is reliable and repeatable.

Learning goals: By the end of this chapter you should be able to

  • Make a data sheet.
  • Label samples.
  • Describe best practices for collecting, storing, and maintaining data.
  • Organize data in folders.
  • Load data into R using a project
  • Write code that allows for readers to understand, replicate, and extend your work.

Since January 2022, The American Naturalist has required authors to include all data and code underlying their conclusions. This policy reflects a broader shift in the scientific community—researchers now expect data to be shared and analyses to be reproducible. This push for reproducibility has tremendous benefits for everyone involved:

In my roles as a biostatistics professor and Data Editor at The American Naturalist, I have found that the greatest beneficiary of reproducible research is often the lead author themselves. In this chapter, we will work through the process of creating reproducible research—from collecting data in the field to writing and sharing R scripts that document your analyses.

The best time to make your research reproducible is while planning your project. The second best time is now.

Making science reproducible

Here, I present a soup-to-nuts breakdown of how to conduct a reproducible research project. I first introduce how to appropriately collect and enter/save data and then how to safely store data. Then, I introduce how to handle your data in R, from loading the data into R, to having a look at the data, and preparing it for analysis, all while making sure your code follows best practices in reproducibility.