I've grown tired of repeating the beginning of R Markdown documents over and over again to set up my preferences for knitting and chunk options. An example:
```{r, include=FALSE}
library(tidyverse)
knitr::opts_chunk$set(error = FALSE, message = FALSE,
warning = FALSE, fig.align = 'center')
knitr::opts_knit$set(root.dir = 'DATA/PATH'))
```
If you use this chunk to begin the majority of you .Rmd
files, can you embed this into the .Renviron
or .RProfile
for an R Project? I know you can load libraries via your .RProfile
, and I know knitr::opts_knit$set
also has some sort of integration with options(knitr.package.foo)
in your .RProfile
, but I have been unsuccessful in getting the options()
route to work, and it only accounts for the knitting options, excluding the chunk options. It feels like there should be an easier way to reproduce this, but I can't find any resources exploring it.