Please have a look at the script below. I have used it many times when rendering rmarkdown files.
The rmarkdown file fiches_automatic.Rmd contains a parameter called “state” which is used in the computations.
The script iterates the rendering of the markdown file and each time passes a different value of the “state” parameter, so that I get automatically a bunch of parametrized reports.
This does not work when I render a quarto file and I use quarto_render().
Can anyone translate this function into something I can use when acting on a quarto qmd file which has again this “state” parameter? Thanks!
render_one <- function(state) {
rmarkdown::render(
'fiches_automatic.Rmd',
output_file = paste0(state, '_report.docx'),
params = list(state = state),
envir = parent.frame()
)
}
state.name <- c("AUT", "BEL", "BGR", "CYP", "CZE", "DEU", "DNK", "ESP", "EST", "FIN",
"FRA", ## "GBR",
"GRC", "HRV", "HUN", "IRL", "ITA", "LTU", "LUX", "LVA", "MLT",
"NLD", "POL", "PRT",
"ROM", "SVK", "SVN", "SWE")
for (state in state.name) {
render_one(state)
}