global comment option for R markdown in knitr

混江龙づ霸主 提交于 2020-01-03 13:59:50

问题


To change the leading characters for the output a knitr chunk in .Rmd has a comment option, like

```{r comment = ""}
1:100
```

Is there a way to set this globally, not separately for every chunk?

opts_knit$set(comment = "")

does not work and I cannot find it anywhere in the documentation.


回答1:


Use opts_chunk$set() because that is a chunk option; opts_knit is for package options (sorry about the similar names which apparently confused you). See http://yihui.name/knitr/options



来源:https://stackoverflow.com/questions/11190281/global-comment-option-for-r-markdown-in-knitr

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!