Manuscritos reproducibles con Quarto

Elena Quintero

2026-05-06

A typical research workflow

  1. Prepare data (spreadsheet)

  2. Analyse data (R)

  3. Write report/paper (Word)

A typical research workflow

However, this workflow can unchain a maelstrom of email attachments …

Problems of a broken workflow

  • How did you get these values? What analysis is behind this figure? Did you account for …?

  • What dataset was used? Which individuals were left out? Where is the clean dataset?

  • Oops, there is an error in the data. Can you repeat the analysis? And update figures/tables in Word!

Copy-pasting can be tedious & problematic

The majority of replication problems emerge because authors either modified their code but failed to update their manuscript or made an error while transcribing their results into their paper - Eubank 2006

Reproducibility problems


You can find difficulties when resuming your own work and you can struggle to reproduce your own results from a few weeks/months/years ago…


Also, revising non-reproducible manuscripts can be very messy

Doing dynamic reports in R

Quarto

Quarto

Quarto connects code with results

Quarto vs. R Markdown

  • Quarto is a command line tool
  • Quarto ≈ R Markdown 2.0
  • Quarto is language-agnostic (does not depend on R)
  • Quarto has all functionality built-in (you don’t need to install another package to create e.g. presentations)
  • The Quarto format is similar to R
  • Markdown Quarto can render R Markdown documents
  • R Markdown will continue to be supported, but Quarto is the focus of new functionality and major development

Quarto

Quarto connects code with results

Quarto structure

Quarto structure

A YAML header: Defines document-wide options. Specifies the output format. Can include several parameters.

Markdown text: Freely add and format text using markdown.

Code chunks: Evaluate code and show its output. Specify global and/or local chunk options (e.g. figure dimensions). Also works with other languages (e.g. Python).

Quarto documents are…

  • Fully reproducible (trace all results including tables and plots)

  • Dynamic (can be regenerated with 1 click)

  • Multiple outputs:

    • documents
    • presentations
    • books
    • websites…

Chunks

Chunks can execute code from different languages

```{r}
plot(iris)
```

Not only R, but also:

  • Python
  • Julia
  • C++
  • SQL
  • Bash
  • Rcpp
  • Stan
  • JavaScript
  • CSS

…etc

Code chunk options (Execution Options)

Chunk options are embbeded with #|

```{r}
#| echo: FALSE
#| eval: TRUE
#| fig-cap: "My figure caption"
plot(iris)
```

Quarto Execution Options

Naming chunks

```{r}
#| label: iris-plot1
#| echo: FALSE
#| eval: TRUE
#| fig-cap: "My figure caption"
plot(iris)
```

Naming chunks

Can help debugging and navigating long docs

Text formatting

Markdown syntaxis

# Header

## Subheader

*italic*

**bold**

[a link](https://example.com)


Can use Visual Markdown Editor

Render

With just one click (Render):

Output formats

  • Reports and general documents (HTML, PDF, Jupyter Notebook, Microsoft Word)
  • Presentations (reveal.js, PowerPoint, Beamer)
  • Interactive documents (Observable, R Shiny)
  • Books, blogs and websites (the course website is done with Quarto)
  • Journal articles
  • Your own custom formats

Let’s try

Writing a quarto document

  • Try visual editor

  • Parameterised reports

  • Add bibliography