r - Rmarkdown global_options vs opts_chunk -


i've searched around bit, , read this can't seem find difference between global_options , opts_chunk.

below code chunk use @ beginning of of rmd files, i've never understood difference. appreciated.

```{r global_options, include=false} # way set options code chunks @ once # note can dynamically control options setting them value # dpi setting increased word output, cairo anti aliasing knitr::opts_chunk$set(echo=false, warning=false, message=false,                       dev="png", fig.width = 10, fig.height = 7, dpi=200, dev.args=list(type="cairo")) ``` 

setting global options apply options of chunks of code in document. global options superseded chunk options. chunk included intended set global options (by calling knitr opts_chunk command). in generally, chunks this:

```{r chunk_name, ...options...}  code code code  ``` 

your chunk called global_options, , has chunk option include=false means when document rendered, chunk executed, results , code not included in rendered document. when render rmd, global options set since code executed, final document won't show options or code used set them.

here 2 nice cheatsheets remind different options , how use markdown docs.

https://www.rstudio.com/wp-content/uploads/2015/02/rmarkdown-cheatsheet.pdf

https://www.rstudio.com/wp-content/uploads/2015/03/rmarkdown-reference.pdf


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -