Open filippogambarota opened 4 years ago
Maybe you could dynamically build the YAML like here. Here's a minimal example:
---
logo: "https://raw.githubusercontent.com/rstudio/pagedown/master/inst/examples/pagedown_hex.svg"
paperwidth: 8.5in
paperheight: 11in
cols: 4
rows: 3
output: pagedown::business_card
---
```{r process-data}
# assume that we have a data.frame with name, surname and institution
df <- data.frame(name = c("Hermione", "Jane"),
surname = c("Granger", "Doe"),
institution = c("Hogwarts", "University of Nowhere"))
person <- apply(df, 1, function(x) {
list(
name = paste(x["name"], x["surname"]),
address = x["institution"]
)
})
```
---
```{r write-yaml, results='asis'}
cat(yaml::as.yaml(list(person = person)))
```
---
I'm creating some tickets (using the business cards template) for an event and I would like to dynamically fill the appropriate fields according to variables in a dataset. Let's say that I have a dataset with a
name
,surname
andinstitution
and I want to generate n tickets according to the correct institution and name. Could it be possibile? I cannot find a way to integrate R objects when creating a ticket using thepagedown example