Skip to content

Instantly share code, notes, and snippets.

You can set default chunk options *outside* the document just like you do it *inside*:
knitr::opts_chunk$set("foobar" = "baz") # set "foobar" = "baz" as default chunk option
Full example:
# `control.R`
library(rmarkdown)
\documentclass{article}
\begin{document}
<<setup, include=FALSE>>=
knitr::opts_chunk$set(echo = TRUE, max.print = NA)
@
<<echo=FALSE, results='hide'>>=
library(DBI)