Reproducible research

Definition

The goal of reproducible research is to tie specific instructions to data analysis and experimental data so that scholarship can be recreated, better understood and verified.

Source: CRAN Taskview

Literate programming

  • A new approach to programming, introduced by Donald Knuth
  • Programme is in natural language, e.g. English
  • Interspersed with macros that contain machine instructions

Example of LaTEX in text

The purpose of wc is to count lines, words, and/or characters in a list of files. The
number of lines in a file is ......../more explanations/

Here, then, is an overview of the file wc.c that is defined by the noweb program wc.nw:
<<*>>=
    <<Header files to include>>
    <<Definitions>>
    <<Global variables>>
    <<Functions>>
    <<The main program>>
    @
We must include the standard I/O definitions, since we want to send formatted output
to stdout and stderr.
<<Header files to include>>=
    #include <stdio.h>
    @

From LaTex to Notebooks

First there was LaTex

Then knitr emerged, followed by rmarkdown

Jupyter Notebooks followed a different evolutionary path

Markdown vs Notebooks

knitr and rmardown Notebooks
Runs in IDE Runs in web browser
R embedded in markdown Markdown and R both embedded as cells
Static Interactive
Better for reporting Better for exploration, prototyping

You can use both systems for creating automated reporting:

  • With knitr use knit() and family
  • With notebooks use nbconvert on the command line