Reproducibility: allows scientific analyses to be documented and replicated.
Automation: generates reports, articles, and presentations without copy-pasting.
Flexibility: supports export to HTML, PDF, Word, and other formats.
Collaboration: facilitates teamwork and the sharing of results.
A system for structuring and formatting text using textual commands.
Unlike a word processor, it separates content from formatting.
Markdown is an example of a simple, human-readable markup language.
Write the code: a text file containing Markdown sections and R code chunks.
Run the code: generates results directly within the document.
Render the document: choose the output format (HTML, PDF, Word, presentations, etc.).
| Feature | Quarto | R Markdown |
|---|---|---|
| Language dependency | Language-independent; works with R, Python, Julia, and Observable JS | Primarily tied to R and the knitr system |
| File extension | .qmd |
.Rmd |
| Rendering engine | Unified Quarto engine (based on Pandoc) | rmarkdown + knitr + Pandoc |
| Multi-language support | Native and seamless (multiple languages in the same document) | Primarily R, with more limited Python support |
| Projects and websites | Built-in support for projects, websites, books, and blogs | Requires different packages (bookdown, blogdown, xaringan, etc.) |
| Feature | Quarto | R Markdown |
|---|---|---|
| Cross-references and citations | Built-in and easy to use | Often require additional configuration or packages |
| Output formats | Unified system (documents, presentations, websites, books) | Different packages for different formats |
| Configuration style | Clearer and more consistent YAML | More fragmented YAML, depending on the output format |
| Future outlook | Modern, actively developed, recommended for new projects | Maintained for compatibility, with slower development |
Quarto is the modern, unified evolution of R Markdown: more powerful, more flexible, and not limited to the R programming language.
Dynamic reports with automatically updated data
Interactive presentations with Reveal.js
Setting up a file for writing theses and academic papers (PDF, Word)
Hands-on exercise with a final presentation
In this course, we will use GitHub to manage the files of our Quarto projects.
It allows us to:
Git is the tool that works behind GitHub.
To get the course files onto your computer:
Code buttonThen open the terminal and type:
This command creates a copy of the repository on your computer.
Go to Github (website)
Click on New repository
Choose:
3.1. Project Name (es. psychology-project)
3.2. A short description (optionsl)
4.1 Public -> anyone can have access to the project
4.2 Private -> you are the only one to see it (and people you invite)
Next:
To connect a local folder to the repository, you can follow the same procedure you used to download the course repository:
Open RStudio and go to File -> New Project
Select New Directory and then `Quarto Project``
Choose the destination folder and give your project a name
Click Create Project
The YAML header allows you to define:
title: document titlesubtitle: subtitleauthor: author(s)date: dateoutput: output formattheme: visual themefontcolor: text colorfig-width: default figure widthcode-fold: code folding (true/false)toc: table of contents (true/false)number-sections: section numberinghtmlpdfwordrevealjspptxbeamerYou can specify multiple output formats in a single YAML header, allowing the document to be rendered in several formats.
# Main heading
## First-level subheading
### Second-level subheading
#### Third-level subheading
This is an **example paragraph** with bold text.
You can also use *italics* or `monospaced text`.
This is an example paragraph with bold text.
You can also use italics or monospaced text.
- Item 1
- Item 2
- Item 3
- Item 4
Item 1
Item 2
Item 3
Elemento 4
Code chunks are used to insert code and run analyses:
warning: if false, warnings from the model and/or function are not displayed.include: determines whether the output is displayed in the report or document.eval: if true, the code is executed; if false, it is not executed at all.echo: if false, the code is hidden; if true, the code used is displayed.```r
#| warning: false
#| include: false
#| eval: false
#| echo: false
summary(cars)
```
To set chunk options in Quarto, using YAML-style syntax, add #| at the beginning of a line inside the chunk.
$$…$$$…$$$ Y = \beta_{0} + \beta_{1} X $$
\[ Y = \beta_{0} + \beta_{1} X\]
To insert code chunks: Ctrl + Alt + I (Windows) or Cmd + Option + I (Mac)
To run code chunks: use Ctrl + Enter (Windows) or Cmd + Enter (Mac)
To generate the final document, click Render (Quarto) or Knit (R Markdown)