Description Usage Arguments Value See Also Examples
Checks to see if the input is logical.
1 2 3 4 5 6 7 | assert_is_a_bool(x, severity = getOption("assertive.severity", "stop"))
assert_is_logical(x, severity = getOption("assertive.severity", "stop"))
is_a_bool(x, .xname = get_name_in_parent(x))
is_logical(x, .xname = get_name_in_parent(x))
|
x |
Input to check. |
severity |
How severe should the consequences of the assertion be?
Either |
.xname |
Not intended to be used directly. |
is_logical
wraps is.logical
, providing more
information on failure. is_a_bool
returns TRUE
if the
input is logical and scalar. The assert_*
functions return
nothing but throw an error if the corresponding is_*
function
returns FALSE
.
is.logical
and is_scalar
.
1 2 3 4 5 6 7 | assert_is_logical(runif(10) > 0.5)
assert_is_a_bool(TRUE)
assert_is_a_bool(NA)
#These examples should fail.
assertive.base::dont_stop(assert_is_logical(1))
assertive.base::dont_stop(assert_is_a_bool(c(TRUE, FALSE)))
assertive.base::dont_stop(assert_is_a_bool(logical()))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.