Assertion for Positive Number

assert_positive_number(x, zero_ok = FALSE)

Arguments

x

what to check.

zero_ok

(flag)
whether x can be zero or not.

Value

Raises an error if x is not a single positive (or non-negative) number.

Examples

assert_positive_number(3.2)
assert_positive_number(0, zero_ok = TRUE)