Quarto & Co

Author

Andreas Handel

Modified

2024-03-20

Overview

This unit provides a brief introduction to the Quarto system.

Learning Objectives

  • Know what Quarto is good for
  • Be able to use Quarto for data analysis

Introduction

Quarto is (according to its website) An open-source scientific and technical publishing system. Quarto is developed by the same company (posit) that develops RStudio. It therefore has very nice integration with R code - but also supports other code, such as Python and Julia. It uses Markdown as the format to write text in.

Quarto overview

The idea behind Quarto is that you have a system that allows you to combine code with text and simple formatting to easily create various useful outputs, such as html files (websites and presentation slides), word and pdf documents (manuscripts and reports), and more.

You can apply layout and styling to those documents, which is done separately from the content. This means you can quickly switch between outputs. Quarto calls various other pieces of software to - almost magically - turn text and code input into a variety of different output formats. The good thing is, you generally don’t need to care what goes on under the hood, it all happens (almost always) smoothly behind the scenes.

Markdown

The text inside a Quarto document is markdown. Markdown is a simple way of writing text with some formatting. Markdown is a simple way of formatting text to get some reasonably nice layouts with minimal effort. It’s a bit like HTML code (or TeX/LaTeX if you are familiar with that), inasmuch as it combines plain text with instructions for formatting it. Markdown is simpler than HTML or LaTeX.

If you have no experience with Markdown, I suggest you go through this nice, short interactive tutorial. A good reference to look up formatting for Markdown until you have it memorized is this online cheat sheet.

The fact that markdown is mainly plain text means you can edit it with any text editor, you can easily track changes, and also turn the text into different output formats.

Literate programming

You can write pure markdown text documents in Quarto that do not contain any code (like this document you are reading). But things become very powerful once you combine text with code in a fairly automated manner, which is the main idea behind Quarto.

This concept behind combining text with code is often referred to as literate programming. It has been around for a while, Quarto is the currently best and most feature-rich implementation of this concept.

Getting started with Quarto

The whole Quarto system is very flexible and powerful (and continues to grow). Because it is very feature rich and you can do a ton, trying to read all about it does not make much sense. The best is a learn it as you need it approach. The Quarto website has great documentation, you’ll likely be going there often.

To get started, follow the get started guide on the Quarto website. Install Quarto and - if you haven’t already - R Studio. (Note that current versions of R Studio have Quarto integrated, but it’s not always the latest version, so doing a separate install of the latest Quarto version is not a bad idea.)

Then go through the very nice Getting Started with Quarto tutorial. The main point is to get an idea of what you can do and play around a bit. You’ll repeatedly be coming back to the Quarto documentation as you try to figure out how to do specific things. So if some of the material in the tutorials is not quite clear on your first pass-through, that’s ok. Just get an overall idea and play around so you feel comfortable.

Quarto versus 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 is already much more full-featured 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. Quarto and R Markdown are very similar, so often what works in one will also work in the other.

Summary

Quarto is a powerful, flexible framework that allows you to perform data analysis and other scientific and technical projects in a very automated, reproducible setup.

Further Resources