This function is identical to base R's stopifnot
,
but it includes logging of the exception message via loggit()
.
Usage
stopifnot(..., exprs, exprObject, local, .loggit = NA, echo = get_echo())
Arguments
- ..., exprs
any number of
R
expressions, which should each evaluate to (a logical vector of all)TRUE
. Use either...
orexprs
, the latter typically an unevaluated expression of the formNote that e.g., positive numbers are not
TRUE
, even when they are coerced toTRUE
, e.g., insideif(.)
or in arithmetic computations inR
. If names are provided to...
, they will be used in lieu of the default error message.- exprObject
alternative to
exprs
or...
: an ‘expression-like’ object, typically anexpression
, but also acall
, aname
, or atomic constant such asTRUE
.- local
(only when
exprs
is used:) indicates theenvironment
in which the expressions should be evaluated; by default the one from wherestopifnot()
has been called.- .loggit
Should the condition message be added to the log? If
NA
the log level set byset_log_level()
is used to determine if the condition should be logged.- echo
Should the log entry (json) be echoed to
stdout
as well?