-
DescriptionHello ! Is it possible to use an R instruction as a parameter in a quarto document? With an .Rmd file, I used this syntax but it doesn't work :
I got this error
Many thanks in advance ! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
This comment has been hidden.
This comment has been hidden.
-
No you can't do that anymore. You need to initialize the values using YAML syntax. It was possible in R Markdown because all happened in R, including the YAML parsing of options, whereas in Quarto R is used only for computation with knitr, and everything else does not use tools like R. This includes parsing parameters to pass them the engine, or allow auto completion, and YAML validation. If you really need to use R syntax, you can use the quarto R package to pass parameters, but this will be converted by the package to YAML equivalent. You can know what to write in YAML using yaml package
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
See the following "knitr" example. ---
title: "Quarto Playground"
format: html
params:
key: !expr "
list(
A = 1+1,
B = letters
)"
---
```{r}
params[["key"]][["A"]]
``` @ddotta Please edit the title to a meaningful one. |
Beta Was this translation helpful? Give feedback.
No you can't do that anymore. You need to initialize the values using YAML syntax. It was possible in R Markdown because all happened in R, including the YAML parsing of options, whereas in Quarto R is used only for computation with knitr, and everything else does not use tools like R. This includes parsing parameters to pass them the engine, or allow auto completion, and YAML validation.
If you really need to use R syntax, you can use the quarto R package to pass parameters, but this will be converted by the package to YAML equivalent.
You can know what to write in YAML using yaml package