reproducible-research

A Reproducible Data Analysis Workflow with R Markdown, Git, Make, and Docker

CC-BY-4.0 License

Stars
122

output:
md_document:
variant: gfm

knitr::opts_chunk$set(echo = TRUE)
library(here)
library(readr)
library(pander)

This is the accompanying GitHub repository to a work in progress paper by Aaron Peikert and Andreas M. Brandmaier .

Abstract

knitr::include_graphics("Images/nutshell.svg")

Resources

resources <- read_csv(here("data", "resources.csv"), trim_ws = FALSE)
pander(
  resources,
  split.tables = Inf,
  split.cells = Inf,
  missing = "",
  keep.line.breaks = TRUE,
  style = "multiline"
)

Compile

The following paragraphs describe how you can obtain a copy of the source files of our manuscript describing reproducible workflows, and create the PDF. Either, you can go the 'standard' way of downloading a local copy of the repository and knit the manuscript file in R, or you can use the reproducible workflow as suggested and use Make to create a container and build the final PDF file in exactly the same virtual computational environment that we used to render the PDF.

Standard Way

Requires: Git, RStudio, pandoc, pandoc-citeproc & rmarkdown.

Open RStudio -> File -> New Project -> Version Control -> Git

Insert:

https://github.com/aaronpeikert/reproducible-research.git

Open manuscript.Rmd click on Knit.

Using a Reproducible Workflow

Does not require R or RStudio, but make & docker.

Execute in Terminal:

git clone https://github.com/aaronpeikert/reproducible-research.git
cd reproducible-research
make build
make all DOCKER=TRUE

Note: Windows user need to manually edit the Makefile and set current_path to the current directory and use make all DOCKER=TRUE WINDOWS=TRUE. We hope that future releases of Docker for Windows will not require that workaround.

Rebuild Everything

In case you experience some unexpected behavior with this workflow, you should check that you have the most recent version (git pull), rebuild the docker image (make build) and force the rebuild of all targets (make -B DOCKER).

git pull && make rebuild && make -B DOCKER=TRUE

Session Info

sessioninfo::session_info()