One frequently asked question about knitr is how to hide package loading messages. For example, when you or library(ggplot2), you may see some loading messages. Such messages can also be suppressed by the chunk option message = FALSE.

    1. ```{r, echo=c(4, 5), message=c(1, 2), warning=2:3}
    2. # one way to generate random N(0, 1) numbers
    3. x <- qnorm(runif(10))
    4. x <- rnorm(10)
    5. for (i in 1:5) warning('Here is the warning ', i)
    6. ```

    You can use negative indices, too. For example, echo = -2 means to exclude the second expression of the source code in the output.

    For source code blocks in the html_document output, if you do not want to completely omit them (echo = FALSE), you may see Section for how to fold them on the page, and allow users to unfold them by clicking the unfolding buttons.