Skip to main content

try_from_sexp_numeric_vec

Function try_from_sexp_numeric_vec 

Source
fn try_from_sexp_numeric_vec<T>(sexp: SEXP) -> Result<Vec<T>, SexpError>
where i32: TryCoerce<T>, f64: TryCoerce<T>, u8: TryCoerce<T>, <i32 as TryCoerce<T>>::Error: Display, <f64 as TryCoerce<T>>::Error: Display, <u8 as TryCoerce<T>>::Error: Display,
Expand description

Convert numeric/logical/raw vectors to Vec<T> with element-wise coercion.

An R NA is an error at its index, whichever storage carries it: NA_integer_ and a logical NA are caught here (the i32::MIN sentinel would otherwise coerce to a finite number), and NA_real_, which an integer target refuses as a NaN, is reported as NA by coerce_real_value. Bind Vec<Option<T>> (see na_vectors) when the caller can pass NA. Per-element failures batch into one diagnostic, by reason and 1-based position.