conf22
together!
(at last!)#start-quarto
Please read and review the entire Code of Conduct carefully: https://www.rstudio.com/conference/2022/2022-conf-code-of-conduct/
RStudio requires that in-person attendees be fully vaccinated against COVID-19 prior to the start of the event.
RStudio requires that you wear a mask that fully covers your mouth and nose at all times in all public spaces. We strongly recommend that you use a correctly fitted N95, KN95, or similar particulate filtering mask; we will have a limited supply available upon request.
Please read and review the entire Code of Conduct carefully: https://www.rstudio.com/conference/2022/2022-conf-code-of-conduct/
We expect everyone at rstudio::conf, whether attending in-person or virtually, to contribute to a welcoming, safe, and tolerant environment.
You can make a personal report:
In person: Contact any rstudio::conf staff member, identifiable by their orange staff t-shirt shirt, or visit the conference registration desk.
By email: Send a message to conf@rstudio.com; event organizers will respond promptly.
By phone: Call 844-448-1212; this phone number will be monitored for the duration of the event.
Need help?
Look for orange shirts!
Hello Quarto
#start-quarto
You know R
You know a little bit of Markdown
You want to learn about Quarto, the next-generation of RMarkdown
Quarto syntax and formats
More Markdown
Even more R along the way!
Carlos Scheidegger - RStudio + Quarto
Isabel Zimmerman - RStudio + Python/Vetiver
Katie Masiello - RStudio + Solutions Engineering
Tan Ho - ML Engineer at Zelus Analytics
v2022.07.0-548
or later?v1.0.35
)?pkg_list <- c(
"tidyverse", "gt", "gtExtras", "reactable", "ggiraph", "here", "quarto",
"rmarkdown", "gtsummary", "palmerpenguins", "fs", "skimr"
)
install.packages(pkg_list)
Great, let’s get started!
In-session:
= Tom isn’t explaining it well enough or I need time
= I have completed the “Our Turn”
Raised hand = I have a question for Tom/TA - please try and make eye-contact with me or the TA, based on I have a “general question” or I’m running into a code error.
Use the https://slido.com with code for questions: #start-quarto
Ease of Use VS Full Details
A straight-forward task - pour the boxed milk into the glass.
Easy to use
A straight-forward task - pour the boxed milk into the glass.
Easy to use
Understanding the full details
https://github.com/jthomasmock/quarto-workshop.git
quarto-workshop
RProject
01:00
Quarto® is an open-source scientific and technical publishing system built on Pandoc
You can weave together narrative text and code to produce elegantly formatted output as documents, web pages, blog posts, books and more.
Shakespeare’s Hamlet as a “Quarto”
knitr
2011-10-16: initial development
2012-01-17: initial CRAN release
50 CRAN releases in 10 years https://cran.r-project.org/src/contrib/Archive/knitr/
rmarkdown
Initial experiment: knitr::pandoc()
(2014)
Matured as the rmarkdown
package (2015)
Quarto is the next-generation of RMarkdown.
For everyone.
Quarto is a command line interface (CLI) that renders plain text formats (
.qmd
,.rmd
,.md
) OR mixed formats (.ipynb
/Jupyter notebook) into static PDF/Word/HTML reports, books, websites, presentations and more
thomasmock$ quarto --help
Usage: quarto
Version: 1.0.36
Description:
Quarto CLI
Options:
-h, --help - Show this help.
-V, --version - Show the version number for this program.
Commands:
render [input] [args...] - Render input file(s) to various document types.
preview [file] [args...] - Render and preview a document or website project.
serve [input] - Serve a Shiny interactive document.
create-project [dir] - Create a project for rendering multiple documents
convert <input> - Convert documents to alternate representations.
pandoc [args...] - Run the version of Pandoc embedded within Quarto.
run [script] [args...] - Run a TypeScript, R, Python, or Lua script.
install <type> [target] - Installs an extension or global dependency.
publish [provider] [path] - Publish a document or project. Available providers include:
check [target] - Verify correct functioning of Quarto installation.
help [command] - Show this help or the help of a sub-command.
knitr
We learned from 10 years of literate programming with knitr
+ rmarkdown
knitr
knitr
knitr
or jupyter
evaluates R/Python/Julia code and returns a .md
file along with the evaluated code.md
file by Pandoc and converted to a final ouput formatHere is an example of a Lua filter that converts strong emphasis to small caps, from https://pandoc.org/lua-filters.html
Lua filters written by R/Python/Julia developers should be interchangeable between formats - not language specific!
So what is Quarto?
Quarto® is an open-source scientific and technical publishing system built on Pandoc
A Quarto document i.e. a
.qmd
is a plain text file, like a.rmd
, that can be rendered to many different formats
Quarto comes “batteries included” straight out of the box
revealjs
)Feature | R Markdown | Quarto |
---|---|---|
Basic Formats | ||
Beamer | ||
PowerPoint | ||
HTML Slides | ||
Advanced Layout |
Feature | R Markdown | Quarto |
---|---|---|
Cross References | ||
Websites & Blogs | ||
Books | ||
Interactivity | Shiny Documents | Quarto Interactive Documents |
Paged HTML | pagedown | Summer 2022 |
Journal Articles | rticles | Summer 2022 |
Dashboards | flexdashboard | Fall 2022 |
.Rmd
or .ipynb
?For some of you - nothing changes! Keep using RMarkdown and Jupyter.
However, most existing .rmd
or .ipynb
can be rendered as-is via Quarto
Since Jupyter notebooks can either be treated as a linear document to be re-executed or an already evaluated document there are additional options like: --execute
Quarto comes out of the box with much better accessibility, better defaults, more options, and a much more consistent syntax.
revealjs
are pandoc-compatible, so RStudio Visual Editor works with themquarto render
format
to html
theme to sketchy
02:00
Collaboration with other colleagues in other languages - shared format, choose your editor and your native language
Source
Output
Source
Output
---
title: "ggplot2 demo"
author: "Norah Jones"
date: "5/22/2021"
format:
html:
fig-width: 8
fig-height: 4
code-fold: true
---
## Air Quality
@fig-airquality further explores the impact of temperature
on ozone level.
```{r}
#| label: fig-airquality
#| fig-cap: Temperature and ozone level.
#| warning: false
library(ggplot2)
ggplot(airquality, aes(Temp, Ozone)) +
geom_point() +
geom_smooth(method = "loess"
)
```
Quarto® is an open-source scientific and technical publishing system built on Pandoc. You can weave together narrative text and code to produce elegantly formatted output as documents, web pages, blog posts, books and more.
No more copy-paste, no more manually rebuilding analyses from disparate components, no more dread when the data is updated and you need to run an analysis.
The YAML metadata or header is:
processed in many stages of the rendering process and can influence the final document in many different ways. It is placed at the very beginning of the document and is read by each of Pandoc, Quarto and
knitr
. Along the way, the information that it contains can affect the code, content, and the rendering process.
Quarto is based on Pandoc and uses its variation of markdown as its underlying document syntax. Pandoc markdown is an extended and slightly revised version of John Gruber’s Markdown syntax.
Markdown is a plain text format that is designed to be easy to write, and, even more importantly, easy to read
Markdown Syntax | Output |
---|---|
|
italics and bold |
|
superscript2 / subscript2 |
|
|
|
verbatim code |
Markdown Syntax | Output |
---|---|
|
Header 1 |
|
Header 2 |
|
Header 3 |
|
Header 4 |
|
Header 5 |
|
Header 6 |
```{python}
#| label: fig-polar
#| fig-cap: "A line plot on a polar axis"
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(
subplot_kw = {'projection': 'polar'}
)
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show()
```
Quarto is a command line interface (CLI) that renders plain text formats (
.qmd
,.rmd
,.md
) OR mixed formats (.ipynb
/Jupyter notebook) into static PDF/Word/HTML reports, books, websites, presentations and more
materials/workshop/01-intro/history.qmd
Render via terminal with quarto render history.qmd --to pdf
Compare to the HTML version
03:00
Quarto questions?
Cmd + Shift + P
or Ctrl + Shift + P
: more shortcuts in the RStudio IDE cheatsheet or RStudio SupportCtrl + I
terminal
thomasmock$ quarto --help
Usage: quarto
Version: 1.0.36
Description:
Quarto CLI
Options:
-h, --help - Show this help.
-V, --version - Show the version number for this program.
Commands:
render [input] [args...] - Render input file(s) to various document types.
preview [file] [args...] - Render and preview a document or website project.
serve [input] - Serve a Shiny interactive document.
create-project [dir] - Create a project for rendering multiple documents
convert <input> - Convert documents to alternate representations.
pandoc [args...] - Run the version of Pandoc embedded within Quarto.
run [script] [args...] - Run a TypeScript, R, Python, or Lua script.
install <type> [target] - Installs an extension or global dependency.
publish [provider] [path] - Publish a document or project. Available providers include:
check [target] - Verify correct functioning of Quarto installation.
help [command] - Show this help or the help of a sub-command.