Quarto Overview

Overview

This unit provides a brief overview of Quarto. Quarto is a versatile and powerful open-source publishing system designed to simplify the creation of reproducible documents, presentations, websites, and more.

Goals

  • Understand what Quarto is and why it is useful.
  • Recognize the basic structure of a Quarto document.
  • Be familiar with common use cases of Quarto.

Reading

What is Quarto?

Quarto is defined as “an open-source scientific and technical publishing system”. In simple terms, Quarto is a piece of (powerful) software that can take various input sources (text, code, etc.) and process them to produce well-formatted output documents that are a seamless combination of text, figures, tables and other elements. Various output formats are available, including HTML, PDF, Word documents, presentations, and websites.

Quarto is the successor of the R Markdown framework, which has been widely used for reproducible research and dynamic reporting in the R community. Building upon R Markdown’s strengths, Quarto extends this capability to other languages like Python, Julia, and others.

Why Quarto?

Traditional methods of authoring scientific and technical documents often involve separate tools for analysis and presentation. For instance, code is written in some language such as R or Julia, then executed. The code produces output such as figures or tables, which might be copied into a Word document, or pasted into a PowerPoint presentation or onto a website. This separation of analysis and presentation is not efficient and creates challenges for reproducibility.

The idea for Quarto is that one can use one unified system that combines input, such as narrative text and executable code, with results such as figures and tables, and easily and automatically generates well-formatted output documents in the form of HTML, PDF, Word, and more. This can lead to a workflow that is much more automated, efficient and reproducible.

Applications of Quarto

Quarto is widely applicable in various scenarios:

  • Academic publishing and reproducible research papers
  • Data analysis reports and interactive dashboards
  • Educational content and tutorials
  • Professional reporting and documentation
  • Websites (such as this one)
  • and more

Quarto vs R Markdown

Quarto is the more powerful successor of R Markdown. R Markdown is still around and functional. However, most effort is going into implementing new features for Quarto, and it has many more features compared to R Markdown.

Occasionally, you might still need to use R Markdown, and you will find a lot of online information for R Markdown. Since Quarto is an evolution of R Markdown and shares many similiarities. Often what works in R Markdown will also work in Quarto.

Basics of Quarto

The Quarto software uses Quarto documents/files as input/source. These are text files with the file extension .qmd. A Quarto document typically consists of three main components:

  1. YAML Front Matter: Metadata and output configurations defined at the beginning of the file.
  2. Markdown Text: Narrative content formatted with Markdown syntax.
  3. Executable Code Chunks: Embedded code blocks (R or another language) executed during rendering.

Here is an example of a minimal Quarto document:


---
title: "Simple Quarto Example"
format: html
---

# This is a heading 

## This is a subheading

Here is text. **This is bold text.** 
Formatting follows the Markdown syntax.

## A code example

Here is a simple example demonstrating the integration of R code within the document.

<!-- ```{r}
x <- seq(1, 10)
y <- x^2
plot(x,y)
``` -->

The code is executed when the Quarto document is processed (rendered), and the resulting figure is automatically included in the output document.

We’ll re-create the document shown above shortly.

Note that what you are seeing here are actually nested Quarto documents. This whole website, including this page, is written in Quarto. Inside the Quarto file that is the source for this page, we included the above Quarto document to illustrate how to write Quarto documents 😁.

Summary

Quarto is a powerful, flexible framework that allows you to perform modeling and data science projects, and many more activities, in a very automated, reproducible setup.

Further Resources

Test yourself

Which statement best describes Quarto?

Quarto is a publishing system that integrates narrative text and executable code to produce output documents.

  • True
  • False
  • False
  • False

Which list matches the three main components of a Quarto document?

A Quarto document is made of YAML front matter, Markdown text, and optional executable code chunks.

  • False
  • True
  • False
  • False

How does Quarto relate to R Markdown?

Quarto builds on the ideas of R Markdown and extends them across languages and features.

  • False
  • False
  • True
  • False

Practice

  • Browse through some of the examples in the Quarto Examples Gallery to see the variety of documents you can create.

  • If you want to sample even more Quarto content and examples, check out the awesome Quarto GitHub repository which contains a large collection of links to all sorts of useful Quarto resources.