I want to pass a list as parameter so that I can loop through that list and print something. Here is a simple example:
---
title: "`r params$report_title`"
author: "`r params$name`"
format: html
params:
report_title: "main title"
name: "author name"
p_list: list("A", "B")
---
Printing each element of the list...
```{r}
#| echo: true
for(p in params$p_list){
print(p)
}
```
Printing the list...
```{r}
#| echo: true
print(params$p_list)
```
Output for first chunk
[1] "list(\"A\", \"B\")"
for second chunk
[1] "list(\"A\", \"B\")"
How to untangle this list so that I can print A and B separately? thanks in advance.