View source: R/60-interval_index-constructors.R
| as_interval_index | R Documentation |
x, start, and endConstructs an interval_index by pairing each element of x with
corresponding start and end endpoints.
as_interval_index(x, start, end, default_query_bounds = "[)")
x |
Elements to add. |
start |
Start endpoints with the same length as |
end |
End endpoints with the same length as |
default_query_bounds |
Boundary convention used as the default for
query operations on this index: one of |
Output is ordered by interval start.
Names on x are preserved as element names.
An interval_index.
ix <- as_interval_index(c("a", "b", "c"), start = c(1, 2, 2), end = c(3, 2, 4))
ix
as.list(peek_all_point(ix, 2))
# Endpoints can be other comparable types
ix_date <- as_interval_index(
c("phase1", "phase2"),
start = as.Date(c("2024-01-01", "2024-01-10")),
end = as.Date(c("2024-01-05", "2024-01-15"))
)
ix_date
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.