Skip to main content

Module as_character

Module as_character 

Source
Expand description

AsCharacter / AsCharacterVec: a label argument read the way Rโ€™s as.character() reads it, from any atomic vector, a factor by its labels. The reading rules are documented on AsCharacterVec.

Re-exportsยง

use crate::expression::RCall; ๐Ÿ”’
use crate::expression::RSymbol; ๐Ÿ”’
use crate::from_r::SexpError; ๐Ÿ”’
use crate::from_r::SexpLengthError; ๐Ÿ”’
use crate::from_r::SexpTypeError; ๐Ÿ”’
use crate::from_r::TryFromSexp; ๐Ÿ”’
use crate::from_r::impl_option_try_from_sexp; ๐Ÿ”’
use crate::gc_protect::OwnedProtect; ๐Ÿ”’
use crate::into_r::IntoR; ๐Ÿ”’
use crate::SEXP; ๐Ÿ”’
use crate::SEXPTYPE; ๐Ÿ”’
use crate::SexpExt; ๐Ÿ”’

Structsยง

AsCharacter
A character scalar read like Rโ€™s as.character(): from an atomic vector of length 1 of any type, a factor by its label. NA of any type is None.
AsCharacterVec
A character vector read like Rโ€™s as.character(): from an atomic vector of any type, a factor by its labels. NA of any type is None.

Functionsยง

check_length_one ๐Ÿ”’
check_type ๐Ÿ”’
Refuse every SEXPTYPE that is not an atomic vector. STRSXP is named as the expected type because that is what the value becomes.
dispatch_as_character ๐Ÿ”’
Evaluate as.character(x) for a classed x, so its method decides the text (factor labels, formatted dates, โ€ฆ).
read_character ๐Ÿ”’
Read any atomic vector into Vec<Option<String>> through Rโ€™s own conversion to character. Also labels double group keys (dataframe::group).