Wrapper around base::seq() that replaces the maximal end value with the supremum and returns an empty vector if b <= a, in the style of Python's range(). Note that peruse::range views end as a supremum, not a maximum, thus range(a,b) is equivalent to the set [a,b) when a < b or {} when b >= a.

range(a, b, ...)

Arguments

a

minimum

b

supremum

...

other params passed to base::seq()

See also

Examples

range(1,5)
#> [1] 1 2 3 4
range(9,10)
#> [1] 9
range(1,6, by = 2)
#> [1] 1 3 5