Consider as an input the tibble:
in_data <- tribble(
~ style, ~input1, ~input2, ~text_input
'style_1', 5, NA, 'first result',
'style_2', 4, 6, 'fun',
'style_1', 2, NA, 'other result')
I would like to do the following:
- have different patterns, e.g.
style_1
andstyle_2
of the kind
style_1.Rmd
---
params:
input1: NA
text_input: ''
---
`r params$text_input` is of the value `r params$input1`
style_2.Rmd
---
params:
input1: NA
input2: NA
text_input: ''
---
```{r}
plot(params$input1, params$input2, main=params$text_input)
```
- somehow
in_data %>% pmap(parse_and_knit)
the documents, where every row gets knitted with its corresponding style and arguments, and finally composed into a document, which would need an additional header probably.
There is heddlr
https://github.com/mikemahoney218/heddlr which does something similar. But it seems to rely on replacing a single argument per "pattern" (which is my "style"). I could make that argument a row number and go pull out data with this information; it would be nicer to take the entire row as params
input in pmap
style.
Is that possible? I can just knit
every piece individually, but I need to compose it to a report in the end, preferably without doing my own DOM magic.