如何将内联代码添加到#|无花果帽:四分之一
更新:
@harre。我遇到了一个问题。
它可以与mtcars
数据集完美。
但是,当我尝试使用已加载的数据框架时,它说:
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
在这种情况下,似乎是四分之一的外观#| ...
df_xxx
未生成。尽管它在环境中,我们无法访问它。 有什么想法吗?
原始问题: 这是一个工作的四重奏exmple:
---
title: "test"
format: revealjs
---
## Quarto example
```{r}
#| label: fig-plot_mtcars
#| fig-cap: nrow(mtcars).
plot(mtcars$mpg, mtcars$disp)
```
输出:
我如何将Inline代码添加到fig.cap:
: 所需的输出:
我尝试了#|图帽:粘贴(“ bla”,nrow(mtcars))
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))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要告诉四分之一的YAML您正在解析要评估的R表达式。 IE:
有关参考,请参见:
https://quarto.org/computations/computations/ r.html#块
You'll need to tell the quarto YAML that you're parsing an R expression to be evaluated. I.e.:
For reference, see:
https://quarto.org/docs/computations/r.html#chunk-options