Bringing together computational research tools in one accessible source, Reproducible Research with R and RStudio guides you in creating dynamic and highly reproducible research. Suitable for researchers in any quantitative empirical discipline, it presents practical tools for data collection, data analysis, and the presentation of results.
With straightforward examples, the book takes you through a reproducible research workflow, showing you how to use:
Whether you’re an advanced user or just getting started with tools such as R and LaTeX, this book saves you time searching for information and helps you successfully carry out computational research. It provides a practical reproducible research workflow that you can use to gather and analyze data as well as dynamically present results in print and on the web. Supplementary files used for the examples and a reproducible research project are available on the author’s website.
Introducing Reproducible Research
What Is Reproducible Research?
Why Should Research Be Reproducible?
Who Should Read This Book?
The Tools of Reproducible Research
Why Use R, knitr, and RStudio for Reproducible Research?
Getting Started with Reproducible Research
The Big Picture: A Workflow for Reproducible Research
Practical Tips for Reproducible Research
Getting Started with R, RStudio, and knitr
Using R: The Basics
Using knitr: The Basics
Getting Started with File Management
File Paths and Naming Conventions
Organizing Your Research Project
Setting Directories as RStudio Projects
R File Manipulation Commands
Unix-like Shell Commands for File Management
File Navigation in RStudio
Data Gathering and Storage
Storing, Collaborating, Accessing Files, and Versioning
Saving Data in Reproducible Formats
Storing Your Files in the Cloud: Dropbox
Storing Your Files in the Cloud: GitHub
RStudio and GitHub
Gathering Data with R
Organize Your Data Gathering: Makefiles
Importing Locally Stored Data Sets
Importing Data Sets from the Internet
Advanced Automatic Data Gathering: Web Scraping
Preparing Data for Analysis
Cleaning Data for Merging
Merging Data Sets
Analysis and Results
Statistical Modeling and knitr
Incorporating Analyses into the Markup
Dynamically Including Modular Analysis Files
Reproducibly Random: set.seed
Computationally Intensive Analyses
Showing Results with Tables
Basic knitr Syntax for Tables
Creating Tables from R Objects
Showing Results with Figures
Including Non-knitted Graphics
Basic knitr Figure Options
Knitting R’s Default Graphics
Including ggplot2 Graphics
Presenting with LaTeX
Bibliographies with BibTeX
Presentations with LaTeX Beamer
Large LaTeX Documents: Theses, Books, and Batch Reports
Planning Large Documents
Large Documents with Traditional LaTeX
knitr and Large Documents
Child Documents in a Different Markup Language
Creating Batch Reports
Presenting on the Web with Markdown
Markdown with Pandoc and Custom CSS
Slideshows with Markdown, knitr, and HTML
Publishing Markdown Documents
Citing Reproducible Research
Licensing Your Reproducible Research
Sharing Your Code in Packages
Project Development: Public or Private?
Is it Possible to Completely Future Proof Your Research?
Christopher Gandrud is a research associate at the Hertie School of Governance. He was previously a lecturer of international relations at Yonsei University and a fellow in government at the London School of Economics (LSE). He has published articles on political economy and quantitative methods in the Review of International Political Economy and the International Political Science Review. He earned a PhD in political science from the LSE.
"Three recent books have significantly influenced how I use R in reproducible work: Dynamic Documents with R and knitr by Yihui Xie, Reproducible Research with R and RStudio by Christopher Gandrud, and Implementing Reproducible Research edited by Victoria Stodden, Friedrich Leisch, and Roger D. Peng … I recommend all three books to R users at any level. There really is something here for everyone."
—Richard Layton, PhD, PE, Rose-Hulman Institute of Technology, Terre Haute, Indiana, USA
CRC Press eBooks are available through VitalSource. The free VitalSource Bookshelf® application allows you to access to your eBooks whenever and wherever you choose.The Bookshelf application offers access: