Parameterized Reports

Quarto supports parameterized documents — templates that accept input values and produce customized output. This is valuable when you need to generate the same report for multiple departments, time periods, or scenarios.

Define parameters in the YAML header with default values:

---
title: "Absenteeism Report"
format: docx
params:
  department: "Operations"
  month: 3
---

Reference parameters in your code with params$department and params$month:

```r
data |>
  filter(Department == params$department,
         Month == params$month) |>
  summary()
```

Render with custom parameter values from R:

quarto::quarto_render("report.qmd",
  execute_params = list(department = "Sales", month = 6))

Or from the terminal:

quarto render report.qmd -P department:Sales -P month:6

This approach lets you maintain a single template and generate dozens of customized reports — one per department, one per month, or any combination — without duplicating code.