Description Usage Arguments Details Value Note See Also Examples

Asses overlap from intervals in one set to intervals in another set, and return the relevant indices.

1 2 3 | ```
## S4 method for signature
## 'Intervals_virtual_or_numeric,Intervals_virtual_or_numeric'
interval_overlap(from, to, check_valid = TRUE)
``` |

`from` |
An |

`to` |
An |

`check_valid` |
Should |

Intervals which meet at endpoints overlap only if both endpoints are
closed. Intervals in `to`

with `NA`

endpoints are
ignored, with a warning; in `from`

, such intervals produce no
matches. Intervals in either `to`

or `from`

which are
actually empty have their endpoints set to `NA`

before
proceeding, with warning, and so do not generate matches. If
eith `to`

or `from`

is a vector of class `"numeric"`

,
overlap will be assess for the corresponding set of points.

A list, with one element for each row/component of `from`

. The
elements are vectors of indices, indicating which `to`

rows (or
components, for the `"numeric"`

method) overlap each interval in
`from`

. A list element of length 0 indicates no overlapping
elements.

If you want real (`type == "R"`

) intervals that overlap in a set
of positive measure — not just at endpoints — set all endpoints to
open (i.e., `close(from) <- FALSE; closed(to) <- FALSE`

) first.

This function is now just a wrapper for `which_nearest`

.

See `which_nearest`

for details on nearby as well as
overlapping intervals in `to`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | ```
# Note that 'from' contains a valid but empty interval.
to <- Intervals(
matrix(
c(
2, 8,
3, 4,
5, 10
),
ncol = 2, byrow = TRUE
),
closed = c( TRUE, FALSE ),
type = "Z"
)
from <- Intervals(
matrix(
c(
2, 8,
8, 9,
6, 9,
11, 12,
3, 3
),
ncol = 2, byrow = TRUE
),
closed = c( TRUE, FALSE ),
type = "Z"
)
rownames(from) <- letters[1:nrow(from)]
empty(to)
empty(from)
interval_overlap(from, to)
# Non-empty real intevals of size 0 can overlap other intervals.
u <- to
type(u) <- "R"
v <- Intervals_full( rep(3,4) )
closed(v)[2,] <- FALSE
v
empty(v)
size(v)
interval_overlap(v, u)
# Working with points
interval_overlap( from, c( 2, 3, 6, NA ) )
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.