global comment option for R markdown in knitr

knitr, r

Solution

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

Problem

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.

Original source