Evaluates an expression while selectively suppressing warnings or messages based on their content.
Usage
suppress_warnings_if(
expr,
msg_contains = "",
fixed = TRUE,
perl = !fixed,
ignore.case = FALSE,
negate = FALSE,
classes = "warning"
)
suppress_messages_if(
expr,
msg_contains = "",
fixed = TRUE,
perl = !fixed,
ignore.case = FALSE,
negate = FALSE,
classes = "message"
)
Arguments
- expr
The expression to evaluate.
- msg_contains
A string to match against the message. Defaults to an empty string (matches all messages).
- fixed
A logical indicating whether
msg_contains
should be matched as a fixed string..- perl
A logical indicating whether Perl-compatible regular expressions should be used for
msg_contains
.- ignore.case
A logical indicating whether the case of
msg_contains
should be ignored.- negate
A logical indicating whether the message matching should be negated (e.g., suppress messages that do not match
msg_contains
).- classes
A character vector of warning or message classes to suppress.