The interval class represents the interval between two points in time.
Usage
interval(start, end = start, ...)
# S3 method for class 'numeric'
interval(start, end = start, era = NULL, ...)
# Default S3 method
interval(start, end = start, ...)
# S3 method for class 'era_yr'
interval(start, end = start, era = NULL, ...)
is_interval(x)Arguments
- start, end
Vectors specifying the earliest and latest points in each interval, respectively. Can be numeric or
era::yr()vectors. Unequal length vectors are recycled to their common length (if possible) using the rules described invctrs::vec_recycle_common().- ...
Arguments passed to methods.
- era
Optional era label or
era::era()object specifying the era of the interval. If this differs fromstartorend, they are harmonised usingera::yr_transform(), if possible.- x
Object to test.
Value
interval() returns an object with S3 class "tempo_interval", representing
a vector of temporal intervals.
is_interval() returns a logical value.
Examples
# Numeric intervals
interval(c(10, 20, 30), c(20, 30, 40))
#> <interval[3]>
#> [1] 10–20 20–30 30–40
# Intervals with calendar era
interval(era::yr(c(100, 200), "BP"), era::yr(c(50, 100), "BP"))
#> <interval[2]>
#> [1] 100–50 BP 200–100 BP
# Shorthand: numeric inputs with era
interval(1000, 1500, "CE")
#> <interval[1]>
#> [1] 1000–1500 CE