Skip to main content

is_null_or_plain_na

Function is_null_or_plain_na 

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

Whether sexp is NULL or a plain NA, R’s untyped missing value: a logical vector of length one holding NA. Its attributes are not looked at, as the R-side check is.null(x) || (is.logical(x) && length(x) == 1L && is.na(x)) does not look at them.

An optional scalar argument reads either as “no value” (#2305), since R users write f(NA) for that. The Option<T> conversions of the scalars (integer, double, string, logical, complex and raw values, the match_arg choice through match_arg_option_from_sexp, and the scalar types of the optional features) start with this test, so a .Call() that skips the R wrapper reads an argument as the wrapper’s own check does. An optional vector (Option<Vec<T>>) does not: there a plain NA is a logical vector of length one, converted or refused as such.