warnifnot: Issue warnings if conditions are not TRUE

View source: R/Stringendo.R

warnifnotR Documentation

Issue warnings if conditions are not TRUE

Description

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.

Usage

warnifnot(...)

Arguments

...

Logical conditions to be checked. Each condition must evaluate to a logical vector. Named arguments will use the name as the warning message.

Value

The function returns invisible(), but issues warnings for each condition that evaluates to FALSE or contains NA.

Examples

warnifnot(6 < 4, 6 > 5)
warnifnot("custom message" = 6 < 4)


vertesy/Stringendo documentation built on Nov. 10, 2024, 4:35 a.m.