Git and Rmarkdown: Two Useful Tools for a Fully Reproducible Workflow
This repository contains materials and slides for a workshop organized by the Open Science Community Amsterdam. It is meant as a short (two hour) teaser for different tools that can be used for a fully reproducible workflow in science.
Licence: cc by-sa-nc 4.0
Author: Julia Haaf
In the debate around the reproducibility crisis, most attention is paid to instances when researchers either trick themselves or others. Recently, however, some of the discussion has also shifted to scientific and reporting mistakes sneaking into the literature without anyone noticing. Whether these are mistakes in reporting statistics (Nuijten et al., 2016) or mistakes in the data collection process (Rouder et al., 2019), they prevent computational and empirical reproducibility of results in the literature. Rouder and colleagues (2019) proposed standardization and computer automation to minimize mistakes in the literature. In this workshop I will give an introduction to two tools we used for automation in the Perception and Cognition Lab at the University of Missouri. Git is a version control system that can be used to publish data or to collaboratively work on data analysis and writing. R Markdown is a file format for making dynamic and fully reproducible documents with R where the analysis code is embedded in the text. Both tools have gained a lot of popularity in the social science workflow and form one route to a fully reproducible workflow of empirical research.
How to Prepare
- Follow the instructions here: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git.
- Make sure to sign up with github (github.com), we will use it as host for our repositories.
- We will use
RStudioas user interface for
git. An alternative is, for example, the github desktop GUI (link).
Install R and RStudio
Follow the instructions here: https://www.reed.edu/data-at-reed/software/R/r_studio_pc.html.
Note 1: The versions in the instructions are out of date. Always install the latest release.
Note 2: The instructions also ask to install
MiKTeX which we'll need as well. If you already use latex you can ignore this step because you most likely already have it installed. Make sure to try Steps 7 and 8 in this case.
Follow the instructions here: https://medium.com/@GalarnykMichael/install-r-and-rstudio-on-mac-e911606ce4f4.
Note: The versions in the instructions are out of date. Always install the latest release.
R: Open the terminal (Ctrl+Alt+t) and type
sudo apt update sudo apt install r-base
RStudio: Go to https://rstudio.com/products/rstudio/download/#download and choose the installer for your system; follow the instructions.
Install some R packages
- Open an
Rconsole, for example by opening
- Type into the R console:
install.packages("rmarkdown") install.packages("knitr") install.packages("devtools") devtools::install_github("crsh/papaja", ref = "devel")