我怎样才能将 Rmarkdown 文件编入嵌入绘图的 html 文件中?

How can I knit a Rmarkdown file into a html file which embeds plots?

在一个rmd文件中,有几个地方会生成图,例如

```{r outliers}
influencePlot (model1)
```

我在 ./figure/ 目录下通过 运行 在 R session

中将文件编织成一个 html 文件和几个图像文件
> library(knitr)
> knit("my.Rmd")

然后 运行 在 bash 会话中

$ pandoc my.md -f markdown -t html -s -o my.html

但是 html 文件没有嵌入图像文件中的绘图,例如:

<img src="figure/outliers-1.png" alt="plot of chunk outliers" />

我想知道如何让 html 文件嵌入图像文件中的绘图并变得独立?

在 RStudio 中,当我单击 "knit to html" 按钮时,它会将绘图图像嵌入到 html 文件中,例如

<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhE...

与 RStudio 的 "knit to html" 按钮等效的命令是什么?

谢谢。

What is the equivalent commands to RStudio's "knit to html" button?

在 YAML header 中提交您的输出,然后使用

rmarkdown::render("Your-RMD-file.Rmd")

或者查看渲染函数及其参数的文档。