R - Markdown avoiding package loading messages R - Markdown avoiding package loading messages r r

R - Markdown avoiding package loading messages


You can use include=FALSE to exclude everything in a chunk.

```{r include=FALSE}source("C:/Rscripts/source.R")```

If you only want to suppress messages, use message=FALSE instead:

```{r message=FALSE}source("C:/Rscripts/source.R")```


```{r results='hide', message=FALSE, warning=FALSE}library(RJSONIO)library(AnotherPackage)```

see Chunk Options in the Knitr docs


My best solution on R Markdown was to create a code chunk only to load libraries and exclude everything in the chunk.

{r results='asis', echo=FALSE, include=FALSE,}knitr::opts_chunk$set(echo = TRUE, warning=FALSE)#formating tableslibrary(xtable)#data wranglinglibrary(dplyr)#text processinglibrary(stringi)