4. 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 principles 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

This chapter walks you through the key steps for making your science reproducible—from field notes to final scripts. You will learn how to:

Then we summarize the chapter, present practice questions, a glossary, a review of R functions and R packages introduced, and present additional resources.