Expand description
AsNumeric / AsNumericVec: a number argument read the way R’s
as.numeric() reads it, from numbers, text, or factor labels. The reading
rules are documented on AsNumericVec.
Structs§
- AsNumeric
- A numeric scalar read like R’s
as.numeric(): from a double, integer, logical, character, or factor (by its labels) of length 1.NAof any type isNone. - AsNumeric
Vec - A numeric vector read like R’s
as.numeric(): from a double, integer, logical, character, or factor (by its labels) vector.NAof any type isNone. - NotNumeric 🔒
- A value that
as.numeric()would turn intoNAwith a coercion warning.
Functions§
- check_
type 🔒 - Refuse every SEXPTYPE the markers do not read.
REALSXPis named as the expected type because that is the storage the value ends up in. - finish 🔒
- Return the values, or the one batched error naming every rejected element.
- is_
blank 🔒 - R’s
isBlankString: empty, or only blank characters. - is_
blank_ 🔒char - Whether
ccounts as blank for R’sisBlankString, which usesiswspacein a UTF-8 locale: Unicode whitespace except NEL (U+0085) and the no-break spaces U+00A0, U+2007 and U+202F, which neither glibc nor macOS classes as space. - is_
na_ 🔒token - The missing-value token
"NA", with blanks around it at most. - level_
label 🔒 - The text of level
k(0-based) of a factor’slevelsSTRSXP. - parse_
charsxp 🔒 - Parse one CHARSXP the way
as.numeric()does. - parse_
nul_ 🔒 ⚠terminated - Parse
sas R’sRealFromStringdoes, plus the"NA"token. - read_
factor_ 🔒labels - Read a factor by its labels: each level is parsed once, then every code
looks its level up. Code
NAisNone; a code outside the levels is a malformed factor (R’sas.character()refuses it too). - read_
numeric 🔒 - Read any accepted input into
Vec<Option<f64>>, collecting every non-numeric element into one error. - refused_
by_ 🔒no_ na - Whether
#[miniextendr(no_na)]refuses a value the markers read:None(every kind ofNA, the text"NA", a blank string) andNaN(also read from the text"NaN"), as R’sanyNA()refuses a numericNaN. - rest_
is_ 🔒blank - Whether the bytes
R_strtodleft unread are blank. They follow an ASCII prefix of a valid UTF-8 string, so a failed UTF-8 check only happens for a split multi-byte character, which is not blank either.
Type Aliases§
- Rejected 🔒
- The rejected-element accumulator: 0-based index and the offending text.