Get Overlap Size between Interval x and y

get_intersect_size(x.start, x.end, y.start, y.end)

Arguments

x.start

start position of interval x.

x.end

start position of interval x.

y.start

start position of interval x.

y.end

start position of interval x.

Value

a numeric vector.

Examples

o1 <- get_intersect_size(1, 5, 3, 20)
o1
#> [1] 3
o2 <- get_intersect_size(3, 20, 1, 10)
o2
#> [1] 8
o3 <- get_intersect_size(c(1, 2, 1), c(10, 4, 6), c(4, 2, 5), c(10, 3, 22))
o3
#> [1] 7 2 2