12 Quarto
Quarto is a new version of an R Markdown file that allows for more file types. The extension for Quarto files is qmd.
12.1 Creation
You can create a new Quarto document in RStudio:
- Quarto Document
- Quarto Presentation
Generally, you will create a Quarto document.
Like with R Markdown, you will be prompted to enter starting information, including:
- The title and author
- Export file type (typically HTML, for this course)
- Engine, which is
knitras we are using R - Editor (visual or source); visual is the default, but source is preferred
- The visual editor shows you what the final document will look like.
- The source editor looks more like R Markdown.
12.2 Components
Similar to R Markdown, a Quarto document has three components:
- YAML metadata
- Code chunks (R in this case)
- Markdown text
Quarto moves the options for each code chunk from inside the curly braces into the code chunk itself. These options are indicated within a chunk by #| at the beginning of the line.
12.3 Render
After rendering, the HTML file will appear in your Files along with the qmd file, which is what is opened upon rendering. Any R code and resulting output will be included, unless the option echo: false is included in the chunk, which disables the printing of code. In that instance, only the R output would be included.
