View source: R/sparse_character.R
| sparse_character | R Documentation |
Construction of vectors where only values and positions are recorded. The Length and default values determine all other information.
sparse_character(values, positions, length, default = "")
values |
character vector, values of non-default entries. |
positions |
integer vector, indices of non-default entries. |
length |
integer value, Length of vector. |
default |
character value, value at indices not specified by |
values and positions are expected to be the same length, and are allowed
to both have zero length.
Allowed values for value are character values. Missing values such as NA
and NA_real_ are allowed as they are turned into NA_character_.
Everything else is disallowed. The values are also not allowed to take the
same value as default.
positions should be integers or integer-like doubles. Everything else is
not allowed. Positions should furthermore be positive (0 not allowed),
unique, and in increasing order. Lastly they should all be smaller that
length.
For developers:
setting options("sparsevctrs.verbose_materialize" = TRUE) will print a
message each time a sparse vector has been forced to materialize.
sparse character vector
sparse_double() sparse_integer()
sparse_character(character(), integer(), 10)
sparse_character(c("A", "C", "E"), c(2, 5, 10), 10)
str(
sparse_character(c("A", "C", "E"), c(2, 5, 10), 1000000000)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.