warnifnot | R Documentation |
The warnifnot()
function checks whether each condition passed to it is TRUE
. If any
condition is not met, a warning is issued but execution continues. This is similar to
stopifnot()
, which throws an error and halts execution, but warnifnot()
only issues a
warning, allowing the program to proceed.
warnifnot(...)
... |
Logical conditions to be checked. Each condition must evaluate to a logical vector. Named arguments will use the name as the warning message. |
The function returns invisible()
, but issues warnings for each condition that evaluates
to FALSE
or contains NA
.
warnifnot(6 < 4, 6 > 5)
warnifnot("custom message" = 6 < 4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.