Skip to contents

Element-wise check if values are NaN. You can also use is.nan(). Only a float holds a NaN, so the answer for any other data type is all FALSE and is built as a constant rather than computed.

Usage

nv_is_nan(x)

Arguments

x

(arrayish)
One input. Can be any data type. An R value materializes at its default data type.

Value

(arrayish)
Has the input's shape and boolean data type.

Examples

# a boolean result, whatever the input's data type
x <- nv_array(c(1, NaN, Inf, -Inf, 0))
nv_is_nan(x)
#> AnvlArray
#>  0
#>  1
#>  0
#>  0
#>  0
#> [ CPUbool{5} ] 

# all FALSE for an integer input, which has no NaN to find
nv_is_nan(nv_array(1:3))
#> AnvlArray
#>  0
#>  0
#>  0
#> [ CPUbool{3} ]