Quarto Vignette Example

Code

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:

  1. Enhanced features: Better support for cross-references, callouts, and other advanced formatting
  2. Multiple engines: Works with R, Python, Julia, and Observable
  3. Modern syntax: Cleaner YAML and chunk options using #| syntax
  4. Better publishing: Improved website and book publishing capabilities

3 Basic Example

Here’s a basic example using the package:

Code
# Create some sample data
sample_data <- c(1, 2, 3, 4, 5, 10, 15, 20)

# Use the example function
result <- example_function(sample_data)
result
#> [1] 4.5

4 Quarto Features

4.1 Callouts

Note

This is a callout block that highlights important information.

Tip

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:

Code
# Create a simple plot
plot(sample_data, 
     main = "Sample Data", 
     xlab = "Index", 
     ylab = "Value",
     pch = 19,
     col = "steelblue")
Figure 1: Example plot showing data distribution

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

Table 1: Comparison of R Markdown and Quarto
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 documentation systems and offer enhanced capabilities for technical documentation.

8 References

For more information, see:

References

R Core Team. 2024. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.
UCD-SERG. 2024. Rpt: R Package Template. https://github.com/UCD-SERG/rpt.