Makes a custom wrapper ALTREP
Arguments
- x
Any R object to wrap
- has_na
Logical scalar.
FALSE
ifx
should be considered to be free ofNA
values, otherwise should be set toTRUE
- is_sorted
Logical scalar.
TRUE
ifx
should be considered sorted,FALSE
if it should be considered unsorted, orNA
if its sorted status is unknown- descending
Logical scalar.
TRUE
ifx
should be considered to be sorted in descending order,FALSE
for ascending order. Ifx
is unsorted this is unused.- na_first
Logical scalar.
TRUE
ifx
should be treated as if it hasNA
values at the start of the vector,FALSE
if they are at the end. Ifx
is unsorted this is unused.
Examples
wrapper <- wrapper_make(c(5, 3, NA, 1), is_sorted = TRUE, has_na = FALSE)
wrapper_details(wrapper)
#> $contents
#> [1] 5 3 NA 1
#>
#> $has_na
#> [1] FALSE
#>
#> $is_sorted
#> [1] TRUE
#>
#> $descending
#> [1] FALSE
#>
#> $na_first
#> [1] FALSE
#>