Learn R Programming

assertive (version 0.2-6)

assert_all_are_finite: Are the inputs (in)finite?

Description

Checks to see if the inputs are (in)finite.

Usage

assert_all_are_finite(x)

assert_any_are_finite(x)

assert_all_are_infinite(x)

assert_any_are_infinite(x)

assert_all_are_negative_infinity(x)

assert_any_are_negative_infinity(x)

assert_all_are_positive_infinity(x)

assert_any_are_positive_infinity(x)

is_finite(x)

is_infinite(x)

is_negative_infinity(x)

is_positive_infinity(x)

Arguments

x
Input to check.

Value

  • is_finite wraps is.finite, showing the names of the inputs in the answer. is_infinite works likewise for is.infinite. The assert_* functions return nothing but throw an error if the corresponding is_* function returns FALSE.

See Also

is.finite

Examples

Run this code
x <- c(0, Inf, -Inf, NA, NaN)
is_finite(x)
is_infinite(x)
is_positive_infinity(x)
is_negative_infinity(x)
assert_all_are_finite(1:10)
assert_any_are_finite(c(1, Inf))
assert_all_are_infinite(c(Inf, -Inf))
dont_stop(assert_all_are_finite(c(0, Inf, -Inf, NA, NaN)))

Run the code above in your browser using DataLab