Skip to main content

Preface How to Use This Book

This book is designed to be flexible. You can read it cover-to-cover, jump directly to specific chapters, or use it as a reference alongside your own projects.

Chapter Anatomy.

The breakdown of the book is as follows:
Most chapters follow a consistent structure:
  • Conceptual explanation of why a tool or method is useful
  • Step-by-step code examples
  • Visualizations and outputs
  • Interpretation and best practices
  • A checklist to reinforce reproducible habits
This repetition is intentional. Consistency helps build intuition.

Code, Data, and Reproducibility.

All code in this book is meant to be run, modified, and occasionally broken. Learning happens when you experiment.

Note 0.0.1. As my father always says:.

The reproresearchR Package.

The datasets used throughout this book are provided in the companion R package reproresearchR, allowing readers to load data directly into R without manually downloading files. This ensures that all examples run the same way for everyone. All figures, tables, and analyses in this book are generated directly from codeβ€”never copied and pasted from external softwareβ€”so that every result is fully reproducible. Chapters 6-8 all use data from the package.
The reproresearchR package also includes two versions of each chapter’s R script:
  • Full Script: the complete code used to generate all analyses and figures in the chapter.
  • Helper Script: a partially completed script with key sections removed, allowing you to work along with the textbook by filling in the missing code.
Once R and the reproresearchR package are installed (with RStudio recommended), readers have everything they need to follow along and successfully complete the analyses in this textbook.

R and RStudio.

If it isn’t already evident, this textbook is about the programming language R. If you want to work with R on your computer, it is suggested that you have both:
If you are not able to download both on your computer but still want to learn and use R, you can use the online version.

The NYC Open Data Student Gallery.

This textbook is part of a broader reproducible research initiative built around real civic data. Students at Brooklyn College used the workflow outlined in this book to conduct original research projects using datasets from New York City’s Open Data portal.
Each student developed a fully reproducible analysis in R, compiled their work into a structured report, and produced a final research project grounded in real public data. These projects were then assembled into a collective publication: the NYC Open Data Student Gallery.
The Gallery showcases student research on topics ranging from public health and environmental conditions to social infrastructure and urban policyβ€”demonstrating that reproducibility is not just a technical skill, but a tool for meaningful civic inquiry.
You can explore the full collection of student projects here: NYC Open Data Student Gallery.
The Gallery reflects what is possible when reproducibility, open data, and structured workflows are integrated into the classroom from day one.

Acknowledgments.

This book would not exist without the curiosity, questions, and persistence of students at Brooklyn College. Their willingness to wrestle with messy data and imperfect code shaped both the content and the tone of this text.
Additional thanks go to the Open Educational Resources team at Brooklyn College and to the broader R community, whose commitment to open tools and shared knowledge makes projects like this possible.

License.

You are free to:
  • Share β€” copy and redistribute the material
  • Adapt β€” remix, transform, and build upon the material
Under the following terms:
  • Attribution β€” You must give appropriate credit.

How to Cite.

If you use this textbook in your teaching, research, or projects, please cite it as:
Martinez, C. (2026). Reproducible Research Using R (Version 1.0.0). Zenodo. doi.org/10.5281/zenodo.19136755
Version History
v1.0.0 (2026):
  • Initial public release
  • Full textbook curriculum covering data analysis, visualization, and modeling in R
  • Used in Fall 2025 coursework at Brooklyn College (CUNY)