'pwalk with multiple params over R Markdown

I am trying to create a serial letter with R Markdown. I have a markdown test.Rmd which I want to serialize with the function rmarkdown::render(). Because I have multiple params which change for each letter of the series I use pwalk with rmarkdown::render and a list which contains the params.

It is a bit complicated to offer a reproducible example, thus I can only show the two functions.

This is the function I use for rendering:

prender_fun <- function(
  year,
  anrede
  ){
  rmarkdown::render(
    input = "test.Rmd",
    params = list(
      year = year,
      anrede = anrede
    )
    )
}

This is the input_list with the params:

input_list$year <- c(1, 2)
input_list$anrede <- c("herr", "frau")

This is the pwalk function:

purrr::pwalk(
  input_list,
  prender_fun
)

My question is: Is there a way (I know there is...) to make the list in the first render function generic e.g. such that there is only one argument in prender_fun with a named list and the list input in params gets generic? Something like this:

prender_fun <- function(example_list){
  rmarkdown::render(
    input = "test.Rmd",
    params = list(
      example_list[[1]] = example_list[[1]],
      example_list[[2]] = example_list[[2]],
      ...,
      example_list[[i]] = example_list[[i]],
    )
    )
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source