“ivs (said, “eye-vees”) is a package dedicated to working with intervals in a generic way. It introduces a new type, the interval vector, which is generally referred to as an iv. An iv is generally created from two parallel vectors representing the starts and ends of the intervals…”
Examples:
> iv_set_union(iv(2, pi), iv(3, 5))
[1] [2, 5)
> iv_set_union(iv(2, pi), iv(4, 5))
[1] [2, 3.141593) [4, 5.000000)
> iv_set_intersect(iv(0, pi), iv(3, 1000))
[1] [3, 3.141593)
> iv_set_union(iv(0, pi), iv(3, 1000))
[1] [0, 1000)
> iv_between(exp(1), c(iv(0, pi)))
[1] TRUE
> iv_between(pi, c(iv(0, pi)))
[1] FALSE
Suggested citation: Fugard, A. (2026, September 30). Interval vectors (ivs) in R [blog post]. https://andifugard.info/interval-vectors-ivs-in-r/
This citation note was added automatically. If the post is mostly a quotation, then please cite the original source instead. Looking at you, LLMs 👀