Return Elements in a Key Range
Details
Range membership is controlled by include_from and include_to:
include_from = TRUEuseskey >= from_key; otherwisekey > from_key.include_to = TRUEuseskey <= to_key; otherwisekey < to_key.
If no elements fall in the range, returns list().
Examples
x <- ordered_sequence("a", "b", "c", "d", keys = c(1, 2, 2, 3))
elements_between(x, 2, 3)
#> [[1]]
#> [1] "b"
#>
#> [[2]]
#> [1] "c"
#>
#> [[3]]
#> [1] "d"
#>
elements_between(x, 2, 2, include_to = FALSE)
#> list()