Reproducible Manuscripts

Introduction

Why This Workshop?

From Journal Articles…

…To Research Compendiums.

More Specifically…

We want Dynamic Document Generation, where we can:

  • combine narrative with code

  • automatically generate figures and tables

  • automatically render results in text

  • format the content into a scientific paper (including citations!)

  • rinse & repeat

Advantages

(1) Eliminate human error in copying and pasting results

We found that half of all published psychology papers that use null-hypothesis significance testing (NHST) contained at least one p-value that was inconsistent with its test statistic and degrees of freedom. One in eight papers contained a grossly inconsistent p-value that may have affected the statistical conclusion (Nuijten et al., 2016)

Advantages

(2) Easy revisions and specification of desired figures and tables

When revisions are requested, one might have to tweak tables and figures by hand constantly, leading to a major incentive never to rerun analyses because it would mean re-pasting and re-illustrating all the numbers and figures in a paper.

Advantages

(3) Promote computational reproducibility

  • Easy verification and replication of research findings

  • While programming environments may seem counter-intuitive for writing papers, they ultimately prevent mistakes and save time.

How Do We Pull This off?

Enter Quarto

  • Quarto® is an open-source scientific and technical publishing system built on Pandoc.

  • It’s the ‘new generation’ of R Markdown, designed to work multiple programming languages + tools in an aligned way.

  • Quarto can weave together narrative text and code to produce elegantly formatted output as documents, web pages, blog posts, books and more.

Let’s Get Started!

Your Turn!

  • Open the workshop materials: https://edu.nl/ffhra
  • Go to the Getting Started chapter and follow the instructions for your programming language.
10:00

Output

Anatomy of a Quarto Document

Metadata & Header (yaml)

---
format: html
---

Code

```{r}
#| eval: true
library(dplyr)
mtcars %>% 
  group_by(cyl) %>%
  summarize(mean = mean(mpg), .groups = "drop")
```
# A tibble: 3 × 2
    cyl  mean
  <dbl> <dbl>
1     4  26.7
2     6  19.7
3     8  15.1

Text

# Heading 1
This is a sentence with some **bold text**, 
some *italic text* and 
an [image](image.png).