-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Labels
upstreamconcerns an upstream library like quarto or pandocconcerns an upstream library like quarto or pandoc
Description
Taking the following example Quarto file:
# life_expectancy_report.qmd
---
title: "Life Expectancy Report for `r params$country`"
format: html
params:
country: "Afghanistan"
---
```{r}
library(tidyverse)
library(gapminder)
```
```{r}
#| label: life-expectancy-data
life_expectancy <-
gapminder |>
filter(country == params$country)
```
## Life Expectancy in `r params$country`
```{r}
#| label: life-expectancy-plot
ggplot(life_expectancy, aes(year, lifeExp)) +
geom_line() +
theme_minimal()
```
When we generate this report for different countries with the following script:
library(quarto)
countries <- c("Afghanistan", "Belgium", "India", "United Kingdom")
for (country in countries) {
quarto_render(
input = "life_expectancy_report.qmd",
output_file = paste0("life_expectancy_", country, ".html"),
execute_params = list(country = country)
)
}We get a different report for each country, but they will all show the exact same plot (namely the one for the last country).
I suspect this is because Quarto will overwrite life_expectancy_report_files/figure-html/life-expectancy-plot-1.png for each input parameter and thus the final HTML files will all show the same plot.
This behaviour is different from rmarkdown::render(), which would correctly show the specific plot in each report.
llrs-roche
Metadata
Metadata
Assignees
Labels
upstreamconcerns an upstream library like quarto or pandocconcerns an upstream library like quarto or pandoc