[Tex/LaTex] Suppress library comments from output with knitr

knitrr

I noticed that some library comment manage to pass through the knitr options, with R 3.0.1 and knitr 1.5 running on Mac OSX 10.8.5. The following MWE

\documentclass{article}

\begin{document}

<<libraries, echo=FALSE, cache=TRUE, warning=FALSE, results='hide', cache.lazy=FALSE, message=FALSE>>=
library(memisc)
1+1
@

\end{document}

will still produce in the output

enter image description here

Is there any way to silence unequivocally and universally the libraries?

NOTE: I think it could be an issue related to how knitr manage the warning messages from R. In this specific case the warning message was successfully suppressed but not the annotation preceding the message.

Best Answer

Following Yihui's advice, I found the best option to be to invoke the warning=F and message=F chunk options, like so:

```{r, message=F, warning=F}
library(memisc)
```

This was using knitr ("Knit HTML") with RStudio to process R markdown.

Related Question