My problem is that doc.hist gets converted to a list in Quarto, where each column is an element in the list, and each entry in the column in an element in that list, and my dates have been converted to a numeric that I'm not sure how to convert back (e.g., 1609891200).
I can probably figure out how to re-create my data frame in my quarto doc, but is there a way I can read it in directly as data frame/tibble?
The execute_params argument is looking for a "A list of named parameters", so when I try with c() instead, I get an error that "render params not declared in the YAML".
execute_params is supposed to override front matter in the YAML block and I'm pretty sure you can't put a data frame in there. For this script
library(quarto)
county <- "Washington County"
Version <- 1.0
Date <- "2022-12-19"
Amendments <- "None"
quarto_render(execute_params = list(county = county,
Version = Version,
Date = Date,
Amendments = Amendments))
I'm curious about why the data frame doesn't work for the Quarto doc though, because it works fine with the RMarkdown file. The documentation for the arguments execute_params (from quarto_render) and params (from rmarkdown::render) both say
"A list of named parameters that override custom params specified within the YAML front-matter"
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.