Update:
@harre. I encountered an issue.
It works perfect with mtcars
dataset.
But when I try to use a loaded dataframe it says:
Fehler in nrow(df_xxx) : Objekt 'df_xxx' nicht gefunden
Ruft auf: paste -> nrow
Fehler in yaml::yaml.load(meta, eval.expr = TRUE) :
Could not evaluate expression: paste(nrow(df_xxx), "blabla")
Ruft auf: .main ... FUN -> parse_block -> partition_chunk -> <Anonymous>
Ausf�hrung angehalten
It seems that quarto looks first #|...
in this case df_xxx
is not generated. Although it is in the environment we have no access to it.
Any idea?
Original question: This is a working quarto exmple:
---
title: "test"
format: revealjs
---
## Quarto example
```{r}
#| label: fig-plot_mtcars
#| fig-cap: nrow(mtcars).
plot(mtcars$mpg, mtcars$disp)
```
output:
How can I add a inline code to fig.cap:
:
desired output:
I have tried with #| fig-cap: paste("bla", nrow(mtcars))
CodePudding user response:
You'll need to tell the quarto YAML that you're parsing an R expression to be evaluated. I.e.:
#| fig-cap: !expr nrow(mtcars)
For reference, see: