Quarto is not R native, but R Markdown is. This explain why you can pass a Data Frame, which is a R object using a R argument in a R function (rmarkdown::render()
). However, quarto render
at command line is not R , and doesn't know about dataframe. When you do quarto_render()
the R function will write for you the CLI command to execute, including passing parameters. Quarto can read parameters in a YAML format, and this is what the R function will do with your parameters (Quarto – Parameters)
Data frame have no representation in YAML - but list does. this is why writing and reading list works.
You need to find workaround for you R only parameter value. Some ideas:
- Use list indeed
- Pass a string as parameters to a file (like a
.rds
file or other that support data.frame object), where you can store your data.frame, and then read it in your parameterized document. I believe this would add one step only between creating the data.frame, and passing it to render function.
Hope it helps understand.