I can use the parameters in the title, but I could not find a way of using them in the subtitle ¿Is it possible?
A minimal example:
---
params:
sp: "Iris"
title: Work on species
subtitle: *`r params$sp`*
format: html
---
## Header
text
```{r}
plot(iris)
```
When it is run, it shows an error:
ERROR: YAMLError: unidentified alias "`r" at line 5, column 14:
subtitle: *`r params$sp`*
It works fine if the same parameter is put in the title instead of the subtitle.
Recognized by R Language Collective
You should write your inline code in a string ""
like this:
---
params:
sp: "Iris"
title: Work on species
subtitle: "*`r params$sp`*"
format: html
---
## Header
text
```{r}
plot(iris)
```
Output:
Recognized by R Language Collective
I found a solution. It is just needed to put the code into quotations.
I don`t know why it is needed in the subtitle but not in the title. Anyway, it worked.
---
params:
sp: "Iris"
title: Work on species
subtitle: '*`r params$sp`*'
format: html
---
## Title
text
```{r}
plot(iris)
```