Output options in r markdown


#1

Hi all, I was wondering about the following.
In the past I used to start my analyses with a script that would connect to a database, fetch data and save it in a folder for further processing. These days I’m not doing this with a script anymore, but rather I have an R markdown file with sql chunks. I prefer this because I get syntax highlighting.

However: is there a way to completely disable output/knitting of the rmd? I don’t care about the final html, I would just like to use rmd as a script with sql highlighting.

Riccardo.


#2

One option is, of course, not to knit it :wink: (you can just run the code chunks as you go, I guess). If you’re looking to set an option for the whole document, you can do so in that initial setup chunk. I’m not totally clear on the use case, but if you don’t want the code evaluated, you’d use eval = FALSE (see chunk options in the knitr docs).

```{r setup}
knitr::opts_chunk$set(eval = FALSE)
```

You might also consider using notebooks, but, again, I’m not 100% sure how you want to use this, so I’m not sure.