Skip to contents

Makes a custom wrapper ALTREP

Usage

wrapper_make(
  x,
  has_na = FALSE,
  is_sorted = NA,
  descending = FALSE,
  na_first = FALSE
)

Arguments

x

Any R object to wrap

has_na

Logical scalar. FALSE if x should be considered to be free of NA values, otherwise should be set to TRUE

is_sorted

Logical scalar. TRUE if x should be considered sorted, FALSE if it should be considered unsorted, or NA if its sorted status is unknown

descending

Logical scalar. TRUE if x should be considered to be sorted in descending order, FALSE for ascending order. If x is unsorted this is unused.

na_first

Logical scalar. TRUE if x should be treated as if it has NA values at the start of the vector, FALSE if they are at the end. If x is unsorted this is unused.

Value

An object identical to x but with some hidden ALTREP metadata applied to it.

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
#>