Session 2
September 5, 2024
Code is interwoven with human-language notes, comments, and documentation.
Some kind of “engine” handles executing the code and weaving together prose, code, and results.
Allows for extended comments on code and reproducible reports and manuscripts
“An open-source scientific and technical publishing system”
Mix markdown, code, and the output of code
Produce beautifully formatted documents in a variety of formats (html, Word, pdf, etc.)
Data analysis notebook
Presentations for collaborators
Reproducible manuscripts
…and more!
In RStudio: File > New File > Quarto Document
Click “Render” to see the rendered output
“Yet another markup language”
Commonly used for configuration files
key: value
pairs
Nesting indicated by indentation with 2 spaces
Markdown is a “markup language” that let’s you write plain text to indicate formatting. For example:
**bold text**
becomes bold text
~~strikethrough~~
becomes strikethrough
$E = mc^2$
becomes \(E = mc^2\)
[link](https://www.google.com)
becomes link
`code()`
becomes code()
Check Help > Markdown quick reference in RStudio
Spaces between elements matter! How would you fix each of these?
###Heading 3
Spaces within elements don’t matter!
This sentence still gets rendered correctly!
Single line breaks don’t separate paragraphs. See?
You need two line breaks for that!
Code chunks can be R, Python, or other languages
If R, code is executed by knitr
engine, otherwise by jupyter
Chunk options as YAML (#| key: value
) modify execution behavior or output formatting
Create a new Quarto Document
Practice editing and rendering
Explore the Visual editor mode
Add citations and cross-references
format: gfm
for “GitHub Flavored Markdown”Getting started with Quarto tutorial
Quarto for Academics talk
#quarto channel in UA Data Science Slack
Rendering to GitHub Flavored Markdown
Use Quarto to create a report for your compendium
Try converting a R script with a lot of comments into a Quarto document instead