Fro*_*om2 11 markdown r pandoc knitr
我正在使用knitr和pandoc将报告写入单词(我们需要能够使用跟踪更改来传播评论等).
它到目前为止工作得非常好,但我发现这些情节都是底部带有字幕的,我不想要字幕.虽然我可以在单词doc中删除它们,但如果我可以阻止它们在代码中显示它会更好.
因此,对于markdown中的以下代码:
Test test test
```{r}
summary(cars)
```
You can also embed plots, for example:
```{r fig.width=7, fig.height=6}
plot(cars)
```
Run Code Online (Sandbox Code Playgroud)
然后我在R中运行以下代码:
library("knitr")
# Stackoverflow table test 1.html
knit2html("captiontest.rmd")
FILE <- "captiontest"
system(paste0("pandoc -o ", FILE, ".docx ", FILE, ".md"))
Run Code Online (Sandbox Code Playgroud)
而word文档中的图表标题为"chunk unnamed-chunk-2"
我知道我可以改变这个标题,例如{r fig.width=7, fig.height=6, fig.cap='hello'},但我认为这fig.cap=NULL会让它隐藏起来.相反,它似乎使整个情节消失.
情节是否需要有标题 - 我是否只需要浏览每个单词doc并手动删除它们?或者有办法隐藏它们吗?
Bra*_*sen 10
有点肮脏的把戏,但是:
您可以设置有fig.cap=""问题的块:
Test test test
```{r}
summary(cars)
```
You can also embed plots, for example:
```{r fig.width=7, fig.height=6, fig.cap=""}
plot(cars)
```
Run Code Online (Sandbox Code Playgroud)
或者,您可以fig.cap=""在Rmd文档开头的初始化块中一次设置所有块:
Test test test
```{r options-chunk}
opts_chunk$set(fig.cap="")
```
```{r}
summary(cars)
```
You can also embed plots, for example:
```{r fig.width=7, fig.height=6}
plot(cars)
```
Run Code Online (Sandbox Code Playgroud)