使用RMarkdown创建具有动态图像数量的Word文档

时间:2019-03-14 14:18:41

标签: r r-markdown

我已将下面的2张图像分别保存到名为bl_convergence_acorr001.pngbl_convergence_acorr002.png的工作目录中。我的目标是在Word文档中添加这些图像。但是图像的数量可能不是静态的,而是动态的。所以我的想法是创建一个列表,其中将保存这些名称。标题也必须采用相同的逻辑。第一个应命名为Figure 1,第二个应命名为Figure 2,以此类推。如何传递在for()循环内添加图像的代码?

1st。 enter image description here 2号 enter image description here

 ---
title: "My Title"
author: "Me"
date:  "1/1/2016"
output: bookdown::word_document2
---


```{r cars, echo=FALSE,fig.cap = ". (m_BARI_POP1_3_PRIMARY_12_ACR20_independent_fixed_fixed, logit_independent_fixed_fixed) Baseline Autocorrelation plots"}
knitr::include_graphics("bl_convergence_acorr001.png")

```


```{r cars2, echo=FALSE,fig.cap = ". (m_BARI_POP1_3_PRIMARY_12_ACR20_independent_fixed_fixed, logit_independent_fixed_fixed) Baseline Trace plots"}
knitr::include_graphics("bl_convergence_acorr002.png")
```

0 个答案:

没有答案