Quarto

— Enables you to weave together content and executable code into a finished document —

Next generation R Markdown

Quarto is a multi-language, next-generation version of R Markdown from Posit, and includes dozens of new features and capabilities while at the same being able to render most existing Rmd files without modification.

Multi-lingual

  • Create dynamic content with Python, R, Julia, and Observable.

  • Author documents as plain text markdown or Jupyter notebooks.

  • Publish high-quality articles, reports, presentations, websites, blogs, and books in HTML, PDF, MS Word, ePub, and more.

  • Author with scientific markdown, including equations, citations, crossrefs, figure panels, callouts, advanced layout, and more.

IDE agnostic

  • RStudio integrated

  • Vs Code extensions

  • Jupyter notebooks

  • Text editor


Quarto Extensions

Extensions are a powerful way to modify and extend the behavior of Quarto.

Comprehensive online docs

This workshop

Outline

  • Elements of a qmd ( ~ 25 minutes)

  • Install and setup ( ~ 20 minutes)

  • Making our first html report ( ~ 30 minutes)

  • Citations & cross-references ( ~ 30 minutes)

  • Making our first pdf report (~ 30 minutes)

Tools

Being taught

  • Quarto

  • RStudio

Not taught

  • R

  • python / julia / js

  • vscode / jupyter

Markdown flavors

Markdown type file extension code chunks
Plain markdown .md no
R markdown .Rmd yes
Quarto markdown .qmd yes

What are code chunks?

Pieces of code that will be execute on report rendering to include output in the report.

``` {{r}}
#| label: code-example

hist(mtcars$mpg)
```

What are code chunks?

These could also be inline code for incorporation into the text parts of a report.

R Markdown | Quarto


Number of observations: `r nrow(mtcars)` . 

Output

Number of observations: 32

How does that work?

R markdown vs. Quarto

Code chunks can be provided inside the code chunk

```{r echo = TRUE, message = FALSE ```

```{r}

#| echo: true

#| message: false

```

Markdown elements

Text Formatting

Markdown Syntax Output
*italics* and **bold**
italics and bold
superscript^2^ / subscript~2~
superscript2 / subscript2
~~strikethrough~~
strikethrough
`verbatim code`
verbatim code

The header yaml

Setting up the document

---
title: "Document title"
author: "Your Name"
execute:
  echo: false
format: html
--- 
---
title: "Document title"
author: "Your Name"
execute:
  echo: false
format: pdf
--- 
---
title: "Document title"
author: "Your Name"
execute:
  echo: false
format: revealjs
--- 
  • Set up important document settings
  • Changing format is easy
    • some settings might not work
  • Many more options
    • some depending on output format
    • some depending on template

Go to RStudio

Exercise

  • Write a little bit about your self. A sentence or two about your background and education.

  • Create a list in your document, listing your favorite foods, at least the top three. Render it in html.

  • Try changing output to pdf.

10:00