
An alternative to stopifnot/assert_that etc
check_that.RdIf the predicate function is true of x then x is returned. Otherwise,
an error is thrown with a custom message.
Usage
check_that(x, predicate, message, pf = parent.frame())Arguments
- x
The object to be checked
- predicate
The predicate function used to check
x- message
A custom error message, as a string. Will be shown to the user if the predicate check does not succeed. Can include
glued variables and{cli}semantic markup.- pf
Set as
parent.frame()so variables in the caller environment can be used in the custom error message.