How to suppress warnings globally

I've tried:

{r box_df, echo = FALSE, message = FALSE, class.warning = NULL}

and

options(warn = -1)

I believe either statement should stop warnings from appearing in the knit file, but they don't. class.warning = FALSE doesn't, either. What's the correct way to suppress warning messages for an entire .Rmd file?

It seems both statements must be included. Either one alone does nothing , but using both does suppress warnings. No idea why -- I'd think one should be enough.

I think you can suppress them in an option chunk placed just after the yaml header
```{r setup, include=FALSE}
knitr::opts_chunk$set(warning = FALSE)
```

You're right, and it's global. Thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.