Description Usage Arguments Value Examples
Unlike base::suppressWarnings()
which suppresses all warnings, it can
suppress some specific warnings and output remain warnings.
1 | suppress_warnings(expr, warn_pattern = NA)
|
expr |
A expression to evaluate. |
warn_pattern |
A character pattern as a regular expression. Default NA means suppressing all warnings. |
The warning message as character string, invisibly.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | suppress_warnings(
{
sqrt(-1)
warning("ooops", call. = FALSE)
},
warn_pattern = "NaN"
)
suppress_warnings(
{
sqrt(-1)
warning("ooops", call. = FALSE)
},
warn_pattern = "o"
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.