Skip to contents

Builds a `charvec`, charport's reference ALTREP character vector class, from the given values. A `charvec` is an ordinary character vector to R code (`typeof(x)` is `"character"`); its strings live as byte views in stable native memory blocks and are only converted to R's interned `CHARSXP` strings when something forces materialization.

Usage

charvec(...)

Arguments

...

values to combine, as in [c()]; non-character values are coerced with [as.character()].

Value

A `charvec` (an ALTREP character vector).

Details

Element bytes and encoding marks are preserved verbatim. `charvec` is a storage/reference class, not an encoding-normalization layer; translation policy belongs in consumers built above charport. `NA_character_` is preserved.

Examples

x <- charvec("hello", "world", NA)
is_charvec(x)
#> [1] TRUE
x[1]
#> [1] "hello"