【发布时间】:2021-12-29 13:55:35
【问题描述】:
我在一个文件夹中有一堆预先保存的图。 我有一个 Rmarkdown(Flexdashboard) 循环这个文件夹并以这种方式在每个选项卡上显示一张图片(一个例子只取一个)
```{r ,results="asis"}
list_plots <- list.files(plots_folder,pattern = ".png", full.names = TRUE)
cat(" \n###", "Tab Name \n")
knitr::include_graphics(list_plots[1])
cat(" \n")
```
这完美无缺。我的问题是使用循环时。选项卡已渲染,但内部没有绘图。这样:
```{r ,results="asis"}
list_plots <- list.files(plots_folder,pattern = ".png", full.names = TRUE)
for(i in plots) {
cat(" \n###", "tab name \n")
knitr::include_graphics(i)
cat(" \n")
}
```
【问题讨论】:
标签: r r-markdown flexdashboard