Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I suppress the warning from including a library when using knitr in R?

I'm using knitr to generate HTML output of my work while using R.

The problem is, when I include a library, such as

library(car)

my R markdown document includes the warning:

## Warning: package 'car' was built under R version 2.15.3

I have tried these solutions, but none work:

```{r }
invisible(library(car)

and

```{r message = FALSE, warnings = FALSE}

along with

```{r results = 'hide'}

and unfortunately none of these options work.

Further options I've tried, and the actual knitr output follow:

enter image description hereenter image description hereenter image description here

How do I suppress the warning from including a library when using knitr in R?

Thanks in advance.

like image 472
tumultous_rooster Avatar asked Apr 21 '14 00:04

tumultous_rooster


People also ask

How do I not include code in R markdown?

include = FALSE prevents code and results from appearing in the finished file. R Markdown still runs the code in the chunk, and the results can be used by other chunks. echo = FALSE prevents code, but not the results from appearing in the finished file. This is a useful way to embed figures.

How do I turn off output in R markdown?

You use results="hide" to hide the results/output (but here the code would still be displayed). You use include=FALSE to have the chunk evaluated, but neither the code nor its output displayed.


1 Answers

Set the following chunk options message=FALSE, warning=FALSE, include=FALSE.

like image 135
Bart Avatar answered Sep 20 '22 18:09

Bart