What is ?
- Unified authoring framework for data science
- Seamlessly combine code, results and prose
- Fully reproducible
- Supports several output formats (e.g. HTML, PDF, Word, Presentations, …)
- Write in one language (Markdown), output to several
- Command line tool
- But don’t worry, you won’t have to deal with the command line
- Create websites, blogs, articles, presentations, books, dashboards (in the next version!)
Why Quarto?
- Communication to decision makers
- Focus on conclusions, not the code behind
- Collaboration with other data scientists
- Interested in conclusions but also the code
- Environment to work in
- Native support for multiple languages
- (R, python, Observable, …)
- You can choose between a source and visual editor
Anatomy of a Quarto document
It contains three important types of content:
- An (optional) YAML header surrounded by
---
.
- Chunks of R code surrounded by
```
.
- Text mixed with simple text formatting like
# heading
and _italics_
.
- Regular text
- Inline code
- Figures
- Tables
- Citations
- Cross-references
- LaTeX Equations
- …
Quarto citations
- Create a references.bib file in your main project folder
- Add
bibliography: references.bib
to the YAML header of your .qmd file
- Add citations in bibtext format to references.bib
- To see an example use
citation(“tidyverse”)
in RStudio
- (Optionally) define a citation style with csl: [path_to_file.csl]
- csl files can be found here: https://github.com/citation-style-language/styles
- You can refer directly to the online file (e.g. https://raw.githubusercontent.com/citation-style-language/styles/master/american-medical-association.csl)
Exercises
- Create a new Quarto document using File > New File > Quarto Document.
- Read the instructions.
- Practice running the chunks individually.
- Then render the document by clicking the appropriate button.
- Verify that you can modify the code, re-run it, and see modified output.
- Add a hyperlink to the course website, re-run it, and see the modified output
- https://c-matos.github.io/Intro-R4Heads/
- Change the output type (html, pdf, docx) and render again (may need some package installation)
Exercises
- Replicate the document “06-quarto.pdf”, using Quarto.
- Create similar documents in docx and html formats