Learn R Programming

assertive (version 0.2-6)

assert_all_are_nan: Is the input (not) NaN?

Description

Checks to see if the input is a number that is(n't) NaN.

Usage

assert_all_are_nan(x)

assert_any_are_nan(x)

assert_all_are_not_nan(x)

assert_any_are_not_nan(x)

is_nan(x)

is_not_nan(x)

Arguments

x
Input to check.

Value

  • is_nan wraps is.nan, coercing the input to numeric if necessary. is_not_nan works similarly, but returns the negation. The assert_* functions return nothing but throw an error if the corresponding is_* function returns FALSE.

See Also

is.nan

Examples

Run this code
x <- c(0, NaN, NA)
is_nan(x)
is_not_nan(x)
assert_all_are_not_nan(1:10)
assert_any_are_not_nan(x)
dont_stop(assert_all_are_not_nan(x))

Run the code above in your browser using DataLab