flowchart LR A[1] --> B(2) B --> C{3} C --> D[4] C --> E[5]
Intro to Quarto
Isabella Velásquez
Agenda
Introduction
Setting Up Quarto
Getting Started with Quarto
Creating Projects
Styling Quarto
Publishing Quarto
Conclusion
My name is Isabella Velásquez.
Requirements
To follow along with the exercises, please be sure that you:
Quarto is an
open-source
scientific and technical
publishing system
built on Pandoc.
Let’s bring R Markdown to everyone!
---
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');
```
---
title: Home
pagetitle: nbdev – Create delightful software with Jupyter Notebooks
page-layout: custom
section-divs: false
css: index.css
toc: false
image: https://nbdev.fast.ai/images/card.png
description: Write, test, document, and distribute software packages and technical articles — all in one place, your notebook.
---
from fastcore.foundation import L
from nbdev import qmd
def img(fname, classes=None, **kwargs): return qmd.img(f"images/{fname}", classes=classes, **kwargs)
def btn(txt, link): return qmd.btn(txt, link=link, classes=['btn-action-primary', 'btn-action', 'btn', 'btn-success', 'btn-lg'])
def banner(txt, classes=None, style=None): return qmd.div(txt, L('hero-banner')+classes, style=style)
features = L(
('docs', 'Beautiful technical documentation and scientific articles with Quarto'),
('testing', 'Out-of-the-box continuous integration with GitHub Actions'),
('packaging', 'Publish code to PyPI and conda, and prose to GitHub Pages'),
('vscode', 'Two-way sync with your favourite IDEs'),
('jupyter', 'Write prose, code, and tests in notebooks — no context-switching'),
('git', 'Git-friendly notebooks: human-readable merge conflicts; no unwanted metadata')
)
Dashboard by Mine Çetinkaya-Rundel
Run R in your Quarto documents thanks to the quarto-webr extension by James Joseph Balamuta.
With Shinylive, you can embed Shiny for Python applications into Quarto documents and run the entire application inside the user’s web browser.
Agenda
Introduction
Setting Up Quarto
Getting Started with Quarto
Creating Projects
Styling Quarto
Publishing Quarto
Conclusion
To create a new document in RStudio, go to File > New File > Quarto Document:
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:
Agenda
Introduction
Setting Up Quarto
Getting Started with Quarto
Creating Projects
Styling Quarto
Publishing Quarto
Conclusion
---
) on either endkey: value
{}
#|
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()
```
```{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 |
|
![]() |
```{markdown}
| 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 |
```{markdown}
| 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 |
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!
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`.
:::
. . .
Tip
Note that there are five types of callouts, including: note
, tip
, warning
, caution
, and important
.
::: {#call1 .callout-note appearance="simple"}
## Pay Attention
Using callouts is an effective way to highlight content that your reader give special consideration or attention.
:::
Pay Attention
Using callouts is an effective way to highlight content that your reader give special consideration or attention.
Warning
.callout-warning
Caution
.callout-caution
Important
.callout-important
```{markdown}
::: {layout-ncol=2}

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
```{markdown}
::: {layout="[[1,1], [1]]"}



:::
```
[]
and {}
for span start and end.class
- behaviorkey="val"
- customizationThis is text that is red.
You can create Revealjs presentations using the revealjs
format.
```{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
Setting Up Quarto
Getting Started with Quarto
Creating Projects
Styling Quarto
Publishing Quarto
Conclusion
Quarto projects are directories that provide:
quarto render myproject
).Agenda
Introduction
Setting Up Quarto
Getting Started with Quarto
Creating Projects
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
Setting Up Quarto
Getting Started with Quarto
Creating Projects
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.
Agenda
Introduction
Setting Up Quarto
Getting Started with Quarto
Creating Projects
Styling Quarto
Publishing Quarto
Conclusion
I hope that you enjoyed this intro to Quarto!
https://ivelasq.quarto.pub/intro-to-quarto-2024/