#> [1] 4.5
Quarto Vignette Example
1 Introduction
This vignette demonstrates how to use Quarto (.qmd) files as vignettes in R packages. Quarto is the next-generation version of R Markdown, offering enhanced features and better integration with multiple programming languages.
2 Why Use Quarto?
Quarto offers several advantages over traditional R Markdown:
- Enhanced features: Better support for cross-references, callouts, and other advanced formatting
- Multiple engines: Works with R, Python, Julia, and Observable
-
Modern syntax: Cleaner YAML and chunk options using
#|syntax - Better publishing: Improved website and book publishing capabilities
3 Basic Example
Here’s a basic example using the package:
4 Quarto Features
4.1 Callouts
This is a callout block that highlights important information.
Quarto supports multiple types of callouts: note, tip, warning, important, and caution.
4.2 Code Chunks with Modern Syntax
You can use the modern #| syntax for chunk options:
# Create a simple plot
plot(sample_data,
main = "Sample Data",
xlab = "Index",
ylab = "Value",
pch = 19,
col = "steelblue")
5 Equations
Quarto has excellent support for mathematical equations using LaTeX syntax:
Inline equation: \(E = mc^2\)
Display equation:
\[ \bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i \]
6 Tables
| Feature | R Markdown | Quarto |
|---|---|---|
| YAML | Standard | Enhanced |
| Chunks | {r, option=value} |
#| option: value |
| Publishing | Good | Excellent |
| Cross-refs | Limited | Native |
7 Summary
Quarto vignettes provide a modern, feature-rich way to document R packages. They integrate seamlessly with pkgdown and offer enhanced capabilities for technical documentation.
8 References
For more information, see:
- Quarto Documentation
- Using Quarto with R
- R Core Team (2024)
- UCD-SERG (2024)