How to use Quarto for Parameterized Reporting

You know. If you wanna.


May 17, 2023

There’s a lot of conversations around about Quarto as a new system for technical communication. And that’s well deserved! Quarto, the successor to the R Markdown system, extends and improves upon its predecessor and produces downright beautiful documents (including this very website).

But as a recovering data analyst, the thing that I’m most excited about with Quarto is its ability to generate reports based on a document template and a handful of parameter values. A whole lot of my professional career has amounted to “report out the same handful of KPIs every day (or month, or quarter), aggregated to each relevant business unit and a handful of combined groups.” R Markdown’s parameterized reporting let me automate that boring stuff and spend my time on more fun (and higher impact) projects, and Quarto supports more or less the same style of templating. As such, this blog post walks through how you can use parameterization to automate your own reporting with Quarto.

A Simple Script

Let’s say that you have a colleague who’s really into elevators (like, inexplicably interested in elevators). Because of this interest, and because you’re already working on a blog post showing off how cool Quarto is, you decide to use data about elevators in a small example script you’re working on to make them happy.

Well, luckily enough, my colleague Emil Hvitfeldt has a package on GitHub with data about elevators. Let’s install it now:

# install.packages("remotes")

This package includes a tibble, elevators, which contains quite a few observations of quite a few variables describing the elevators throughout New York City: