assert_is_if_condition

0th

Percentile

Is suitable to be used as an if condition

Is suitable to be used as an if condition

Usage
assert_is_if_condition(x, severity = getOption("assertive.severity",
  "stop"))

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

Arguments
x

Input to check.

severity

How severe should the consequences of the assertion be? Either "stop", "warning", "message", or "none".

.xname

Not intended to be used directly.

Value

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

Note

if will try to do the right thing if you pass it a number or a string, but this function assumes you want to do the right thing and pass either TRUE or FALSE, maybe with some attributes.

Aliases
  • assert_is_if_condition
  • is_if_condition
Examples
# NOT RUN {
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)
assertive.base::dont_stop(assert_is_if_condition(raw(1)))
# }
Documentation reproduced from package assertive.code, version 0.0-3, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.