Learn R Programming

assertive (version 0.2-6)

assert_is_if_condition: Is suitable to be used as an if condition

Description

Is suitable to be used as an if condition

Usage

assert_is_if_condition(x)

is_if_condition(x, .xname = get_name_in_parent(x))

Arguments

x
Input to check.
.xname
Not intended to be used directly.

Value

  • is_if_condition returns TRUE if the input is scalar TRUE or FALSE.

Examples

Run this code
is_if_condition(TRUE)
is_if_condition(FALSE)
is_if_condition(NA)
is_if_condition(c(TRUE, FALSE))
is_if_condition("the truth")
# You can pass a number as a logical condition, but you shouldn't,
# so the next line returns FALSE.
is_if_condition(1)
dont_stop(assert_is_if_condition(raw(1)))

Run the code above in your browser using DataLab