Skip to main content

any_na

Function any_na 

Source
pub(crate) fn any_na(sexp: SEXP) -> bool
Expand description

Whether R’s anyNA(sexp) is TRUE: the check no_na’s R guard makes, done in Rust on an argument that the guard does not cover (see TryFromSexp::__mx_input_has_na).

It follows R’s rules (anyNA / is.na in src/main/coerce.c). A double or complex value counts when it is NaN (ISNAN, so NaN counts as well as NA). A logical or integer counts when it is NA_INTEGER, and a string when it is NA_STRING. Raw vectors and NULL never count. A list counts when one of its elements is a length-1 atomic NA (anyNA() is not recursive by default), and a data frame when one of its columns counts (anyNA.data.frame). Any other type (an external pointer, an environment, …) holds no NA. A classed value is read by its type. The one gap is a class with its own is.na() method, such as POSIXlt.

An ALTREP vector is read element by element (*_ELT), as R does: a data pointer would expand a compact sequence, and some classes have none.