Find missing (NA) values. This is smart enough to distinguish them from NaN values in numeric x. For all other types, it just calls is.na or anyNA.

anyMissing(x)

is.missing(x)

Arguments

x

Vector or array of atomic values.

Value

For anyMissing, a logical scalar indicating whether any NA values were present in x.

For is.missing, a logical vector or array of shape equal to x, indicating whether each value is NA.

Author

Aaron Lun

Examples

anyNA(c(NaN))
#> [1] TRUE
anyNA(c(NA))
#> [1] TRUE
anyMissing(c(NaN))
#> [1] FALSE
anyMissing(c(NA))
#> [1] TRUE

is.na(c(NA, NaN))
#> [1] TRUE TRUE
is.missing(c(NA, NaN))
#> [1]  TRUE FALSE