Introduction to Quarto

Session - Introduction

Zoë Turner

Agenda - session one (about 3.5 hours)

Chapter overview

  • Getting set up
  • What’s inside?
  • Source and visual views in RStudio

——— Break ———–

  • Text
  • Images
  • Code chunks

Agenda - session two (about 3.5 hours)

Chapter overview

  • Inline code
  • Tabs
  • Output Formats

——— Break ———–

  • Features of YAML
  • Rendering
  • Parameters

Course Aims

  • Get set up using Quarto within RStudio
  • To introduce Quarto as a way to produce reports/slides/books and websites
  • Show the potential for using Quarto as a work flow for any analysis project

What is Quarto? Is it…

  • “An open-source scientific and technical publishing system”

  • A document format (.qmd)

  • An R package named quarto

  • A publishing system for making dynamic documents with R, Python, Julia and Observable

  • “a unified authoring framework for data science, combining your code, its results, and your prose”

  • Wizardry

What is Quarto - answers

Let’s get started

Checking first…

That everyone is:

  • set up on RStudio Cloud (own laptops are fine to use instead with the latest RStudio)

Quarto the CLI command line interface (important)

  • Quarto is an addition to the RStudio IDE
  • {quarto} the package has functions the run some of the commands - more later

Together we’ll open a Quarto template

  • Go to File/New File/Quarto document...
  • A wizard will prompt a Title and Author - select Create
  • Render this document to create the html output using the blue arrow to the right
  • This will prompt a name to save the file

File permissions (warning)

  • the file must have access to write/save files to the same folder that the .qmd is in
  • it will create supporting files and folders and then clear them away

Your turn

Open the file covid-analysis.qmd, then Render to HTML

Try to identify these parts in the source and the output:

  1. The metadata
  2. The text
  3. The code
  4. The output

If this was easy, try to find all code that produces a plot.

02:00

Basic anatomy

We look at the underlying source anatomy for qmd together:

  1. The metadata called a YAML (yet another markup language)
  2. The text which supports markdown
  3. The code for this course we’ll use R but this could be other languages
  4. The output this is an html report

End session