在使用knitr和pandoc创建docx文件时,是否有方法隐藏图形标题?

在使用knitr和pandoc创建docx文件时,是否有方法隐藏图形标题?,r,markdown,knitr,pandoc,R,Markdown,Knitr,Pandoc,我正在使用knitr和pandoc将报告写入word(我们需要能够通过跟踪更改等方式发布评论) 到目前为止,它工作得很好,但我发现所有的情节都在底部有字幕,我不想要字幕。虽然我可以在worddoc中删除它们,但如果我能阻止它们在代码中显示,那就更好了 因此,对于以下标记中的代码: Test test test ```{r} summary(cars) ``` You can also embed plots, for example: ```{r fig.width=7, fig.heig

我正在使用knitr和pandoc将报告写入word(我们需要能够通过跟踪更改等方式发布评论)

到目前为止,它工作得很好,但我发现所有的情节都在底部有字幕,我不想要字幕。虽然我可以在worddoc中删除它们,但如果我能阻止它们在代码中显示,那就更好了

因此,对于以下标记中的代码:

Test test test

```{r}
summary(cars)
```

You can also embed plots, for example:

```{r fig.width=7, fig.height=6}
plot(cars)
```
然后在R中运行以下代码:

library("knitr")

# Stackoverflow table test 1.html

knit2html("captiontest.rmd")

FILE <- "captiontest"

system(paste0("pandoc -o ", FILE, ".docx ", FILE, ".md"))
库(“knitr”)
#Stackoverflow表测试1.html
knit2html(“captiontest.rmd”)

FILE有点肮脏,但是:

您可以在相关区块上设置
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)
```
或者,您可以在Rmd文档开头的初始化块中,一次性为所有块设置
fig.cap=”“

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)
```

啊,鬼鬼祟祟的,而且能够同时为所有人设置它很有用。谢谢:)(我觉得我应该试试看!)将fig.cap设置为NULL或NA感觉它们应该直观地提供相同的结果。我有代码(我去年从其他人那里修改过),可以在我的数字上方创建编号良好的标题。最近(我不记得什么时候),我的数字下面也有标题。为什么
knit.hook
不覆盖这一点:
#用zfn对数字进行编号,并制作一个漂亮的标题zfn=local({i=0函数(x){i@jessi我想你应该打开一个新问题。:)