build-parameterized-reportlisted
Install: claude install-skill pjt222/agent-almanac
# Build Parameterized Report
Create reports that accept parameters to generate multiple customized variations from a single template.
## When to Use
- Generating the same report for different departments, regions, or time periods
- Creating client-specific reports from a template
- Building dashboards that filter to specific subsets
- Automating recurring reports with different inputs
## Inputs
- **Required**: Report template (Quarto or R Markdown)
- **Required**: Parameter definitions (names, types, defaults)
- **Optional**: List of parameter values for batch generation
- **Optional**: Output directory for generated reports
## Procedure
### Step 1: Define Parameters in YAML
For Quarto (`report.qmd`):
```yaml
---
title: "Sales Report: `r params$region`"
params:
region: "North America"
year: 2025
include_forecast: true
format:
html:
toc: true
---
```
For R Markdown (`report.Rmd`):
```yaml
---
title: "Sales Report"
params:
region: "North America"
year: 2025
include_forecast: true
output: html_document
---
```
**Got:** The YAML header contains a `params:` block with named parameters, each having a default value of the correct type.
**If fail:** If rendering fails with "object 'params' not found", ensure the `params:` block is correctly indented under the YAML frontmatter. For Quarto, `params` must be at the top level of the YAML, not nested under `format:`.
### Step 2: Use Parameters in Code
````markdown
```{r}
#| label: filter-data
data <- full