Count Elements in a Key Range
Details
Uses the same range semantics as elements_between() but returns only the
count:
include_from = TRUEuseskey >= from_key; otherwisekey > from_key.include_to = TRUEuseskey <= to_key; otherwisekey < to_key.
Examples
x <- ordered_sequence("a", "b", "c", "d", keys = c(1, 2, 2, 3))
count_between(x, 2, 3)
#> [1] 3
count_between(x, 2, 2, include_to = FALSE)
#> [1] 0