Chapter 11 Chunk Options
As illustrated in Figure 2.1, the R package knitr plays a critical role in R Markdown. In this chapter and the next three chapters, we show some recipes related to knitr.
There are more than 50 chunk options that can be used to fine-tune the behavior of knitr when processing R chunks. Please refer to the online documentation at https://yihui.org/knitr/options/ for the full list of options.
In the following sections, we only show examples of applying chunk options to individual code chunks. However, please be aware of the fact that any chunk options can also be applied globally to a whole document, so you do not have to repeat the options in every single code chunk. To set chunk options globally, call
knitr::opts_chunk$set() in a code chunk (usually the first one in the document), e.g.,