suppress {pkgcond} | R Documentation |
Selectively suppress warnings and messages
Description
This collection of functions allow the suppression of condition messages, warnings and messages, through filtering the condition message, the condition class or a combination of the two.
Usage
suppress_conditions(expr, pattern = NULL, class = NULL, ...)
suppress_warnings(expr, pattern = NULL, class = "warning", ...)
suppress_messages(expr, pattern = NULL, class = "message", ...)
Arguments
expr |
An expression to evaluate. |
pattern |
A regular expression pattern to match on. |
class |
The class or classes that you would like to filter. When more that one is given the condition may match any of the classes. |
... |
Arguments passed on to
|
Functions
-
suppress_conditions
: The general case of suppressing both messages and warnings. -
suppress_warnings
: A convenience wrapper that specifies warning class to suppress. -
suppress_messages
: A convenience wrapper that specifies warning class to suppress.
Examples
## Not run:
testit <- function(){
warning("this function does nothing.")
warning("it's pretty useless.")
}
suppress_warning(testit(), "useless") # Will suppress only the second warning by pattern
# If my_pkg used pkgcond for conditions,
# This would suppress all messages and warnings originating
# in my_pkg functions.
suppress_conditions(my_function(), class='my_pkg-condition')
## End(Not run)