flowchart LR A[1] --> B(2) B --> C{3} C --> D[4] C --> E[5]
Intro to Quarto
Isabella Velásquez
R-Ladies St. Louis
Agenda
Introduction
About Quarto
How to use Quarto
Get Started with Quarto
Styling Quarto
Publishing Quarto
Conclusion
My name is Isabella Velásquez.
ivelasq3 | ivelasq | ivelasq | ivelasq.rbind.io
Agenda
Introduction
About Quarto
How to use Quarto
Get Started with Quarto
Styling Quarto
Publishing Quarto
Conclusion
Quarto® is an
open-source
scientific and technical
publishing system
built on Pandoc.
Can we reimplement R Markdown such that it’s not tied to R?
Let’s bring R Markdown to everybody!
“Quarto is the format of a book or
pamphlet produced from full sheets
printed with eight pages of text, four to a
side, then folded twice to produce four leaves.”
— Wikipedia
---
title: "ggplot2 demo"
format:
html:
code-fold: true
---
## Meet Quarto
Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.
```{r}
#| label: plot-penguins
#| echo: false
#| message: false
#| warning: false
library(tidyverse)
library(palmerpenguins)
ggplot(penguins,
aes(x = flipper_length_mm, y = bill_length_mm)) +
geom_point(aes(color = species, shape = species)) +
scale_color_manual(values = c("darkorange","purple","cyan4")) +
labs(
title = "Flipper and bill length",
subtitle = "Dimensions for penguins at Palmer Station LTER",
x = "Flipper length (mm)", y = "Bill length (mm)",
color = "Penguin species", shape = "Penguin species"
) +
theme_minimal()
```
---
title: "Palmer Penguins Demo"
format:
html:
code-fold: true
jupyter: python3
---
## Meet Quarto
Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.
```{python}
#| echo: false
#| message: false
import pandas as pd
import seaborn as sns
from palmerpenguins import load_penguins
sns.set_style('whitegrid')
penguins = load_penguins()
g = sns.lmplot(x="flipper_length_mm",
y="body_mass_g",
hue="species",
height=7,
data=penguins,
palette=['#FF8C00','#159090','#A034F0']);
g.set_xlabels('Flipper Length');
g.set_ylabels('Body Mass');
```
Agenda
Introduction
About Quarto
How to use Quarto
Get Started with Quarto
Styling Quarto
Publishing Quarto
Conclusion
Use the Render button () in the RStudio IDE to render the file and preview the output with a single click or keyboard shortcut (⇧⌘K).
Automatically render on save by checking the Render on Save option:
YAML code completion is available for project files, YAML front matter, and executable cell options:
If you have incorrect YAML it will also be highlighted when documents are saved:
Let’s try it!
Let’s try it!
---
) on either endkey: value
---
title: "Penguins, meet Quarto!"
subtitle: "Intro to Quarto Exercise"
format: html
editor: visual
---
Let’s try it!
{}
#|
at the beginning of the line```{r, label="plot-penguins", warning=FALSE, echo=FALSE}
ggplot(penguins,
aes(x = flipper_length_mm, y = bill_length_mm)) +
geom_point(aes(color = species, shape = species)) +
scale_color_manual(values = c("darkorange","purple","cyan4")) +
labs(
title = "Flipper and bill length",
subtitle = "Dimensions for penguins at Palmer Station LTER",
x = "Flipper length (mm)", y = "Bill length (mm)",
color = "Penguin species", shape = "Penguin species"
) +
theme_minimal()
```
```{r}
#| label: plot-penguins
#| warning: false
#| echo: false
ggplot(penguins,
aes(x = flipper_length_mm, y = bill_length_mm)) +
geom_point(aes(color = species, shape = species)) +
scale_color_manual(values = c("darkorange","purple","cyan4")) +
labs(
title = "Flipper and bill length",
subtitle = "Dimensions for penguins at Palmer Station LTER",
x = "Flipper length (mm)", y = "Bill length (mm)",
color = "Penguin species", shape = "Penguin species"
) +
theme_minimal()
```
```{r}
#| label: plot-penguins
#| warning: false
#| echo: false
#| fig.alt: "Scatterplot with flipper length in millimeters on
#| the x-axis, bill length in millimeters on the y-axis, colored
#| by species, showing a slightly positive relationship with
#| Chinstrap penguins having higher bill length but lower body
#| mass, Adelie with low bill length and low body mass, and
#| Gentoo with high body mass and high bill length."
ggplot(penguins,
aes(x = flipper_length_mm, y = bill_length_mm)) +
geom_point(aes(color = species, shape = species)) +
scale_color_manual(values = c("darkorange","purple","cyan4")) +
labs(
title = "Flipper and bill length",
subtitle = "Dimensions for penguins at Palmer Station LTER",
x = "Flipper length (mm)", y = "Bill length (mm)",
color = "Penguin species", shape = "Penguin species"
) +
theme_minimal()
```
Let’s try it!
```{r}
#| label: fig-penguins
#| warning: false
ggplot(penguins,
aes(x = flipper_length_mm, y = bill_length_mm)) +
geom_point(aes(color = species, shape = species)) +
scale_color_manual(values = c("darkorange", "purple", "cyan4")) +
labs(
title = "Flipper and bill length",
subtitle = "Dimensions for penguins at Palmer Station LTER",
x = "Flipper length (mm)",
y = "Bill length (mm)",
color = "Penguin species",
shape = "Penguin species"
) +
theme_minimal()
```
See @fig-penguins.
Put two plots side by side:
Put two plots side by side:
Put two plots side by side:
Use the YAML to control options for all code chunks.
Hide all of the code and just show the output by specifying echo: false
within the execute
option in the YAML.
One chunk
```{r}
#| label: plot-penguins
#| echo: false
ggplot(penguins,
aes(x = flipper_length_mm, y = bill_length_mm)) +
geom_point(aes(color = species, shape = species)) +
scale_color_manual(values = c("darkorange","purple","cyan4")) +
labs(
title = "Flipper and bill length",
subtitle = "Dimensions for penguins at Palmer Station LTER",
x = "Flipper length (mm)", y = "Bill length (mm)",
color = "Penguin species", shape = "Penguin species"
) +
theme_minimal()
```
Needs downlit package
The `penguins` data from the [**palmerpenguins**](https://allisonhorst.github.io/palmerpenguins "palmerpenguins R package") package contains size measurements for `r nrow(penguins)` penguins from three species observed on three islands in the Palmer Archipelago, Antarctica.
The penguins
data from the palmerpenguins package contains size measurements for 344 penguins from three species observed on three islands in the Palmer Archipelago, Antarctica.
Markdown Syntax | Output |
---|---|
|
italics and bold |
|
superscript2 / subscript2 |
|
|
|
verbatim code |
Markdown Syntax | Output |
---|---|
|
https://quarto.org |
|
Quarto |
|
| Right | Left | Default | Center |
|------:|:-----|---------|:------:|
| 12 | 12 | 12 | 12 |
| 123 | 123 | 123 | 123 |
| 1 | 1 | 1 | 1 |
Right | Left | Default | Center |
---|---|---|---|
12 | 12 | 12 | 12 |
123 | 123 | 123 | 123 |
1 | 1 | 1 | 1 |
| Right | Left | Default | Center |
|------:|:-----|---------|:------:|
| 12 | 12 | 12 | 12 |
| 123 | 123 | 123 | 123 |
| 1 | 1 | 1 | 1 |
: Table Column Widths {tbl-colwidths="[10,30,30,30]"}
Right | Left | Default | Center |
---|---|---|---|
12 | 12 | 12 | 12 |
123 | 123 | 123 | 123 |
1 | 1 | 1 | 1 |
Let’s try it!
Quarto has native support for embedding Mermaid and Graphviz diagrams.
\[E = mc^{2}\]
HTML pages rendered with Quarto include a formatted title banner at the start of the article.
Toggle on…
Use a color…
Or a photo!
---
title: "Penguins, meet Quarto!"
title-block-banner: "banner-image.jpg"
format: html
editor: visual
---
Let’s try it!
You can add classes, attributes, and other identifiers to content using Divs and Spans.
::: {.border}
This content can be styled with a border
:::
[This is *some text*]{.class key="val"}
:::
- Div start and end#id
- label.class
- behaviorattribute=value
- customization:::{.callout-tip}
Note that there are five types of callouts, including:
`note`, `tip`, `warning`, `caution`, and `important`.
:::
::: {layout-ncol=2}
![](penguin.jpg)
Photo by <a href="https://unsplash.com/@corneliusventures?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Cornelius Ventures</a> on <a href="https://unsplash.com/s/photos/penguin?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
:::
Photo by Cornelius Ventures on Unsplash
::: {layout="[[1,1], [1]]"}
![penguin 1](penguin.jpg)
![penguin 2](penguin.jpg)
![penguin 3](penguin.jpg)
:::
[]
and {}
for span start and end.class
- behaviorkey="val"
- customizationThis is text that is red.
You can create Revealjs presentations using the revealjs
format.
Let’s try it!
```{r}
#| echo: true
#| eval: FALSE
#| code-line-numbers: 3-4
ggplot(penguins,
aes(x = flipper_length_mm, y = bill_length_mm)) +
geom_point(aes(color = species, shape = species)) +
scale_color_manual(values = c("darkorange","purple","cyan4"))
```
Agenda
Introduction
About Quarto
How to use Quarto
Get Started with Quarto
Styling Quarto
Publishing Quarto
Conclusion
To create a new document in RStudio, go to File > New File > Quarto Document:
Quarto projects are directories that provide:
quarto render myproject
).Agenda
Introduction
About Quarto
How to use Quarto
Get Started with Quarto
Styling Quarto
Publishing Quarto
Conclusion
Quarto includes 25 themes from the Bootswatch project:
Use these themes under the theme
option in the YAML:
You can do extensive additional customization using SASS theme files.
Provide the custom theme under theme
:
Quarto also allows you to use a dark and light theme.
Agenda
Introduction
About Quarto
How to use Quarto
Get Started with Quarto
Styling Quarto
Publishing Quarto
Conclusion
Since content rendered with Quarto uses standard formats (HTML, PDFs, MS Word, etc.) it can be published anywhere.
Some options:
Quarto Pub is a free publishing service for content created with Quarto.
Terminal
Let’s try it!
Agenda
Introduction
About Quarto
How to use Quarto
Get Started with Quarto
Styling Quarto
Publishing Quarto
Conclusion
I hope that you enjoyed this intro to Quarto!
https://ivelasq.quarto.pub/intro-to-quarto/