tempo is an R package that provides a formal representation of intervals between two points in time (periods) and the potential logical relations between them.
You can install the development version of tempo from GitHub with the remotes package:
remotes::install_github("joeroe/tempo")Test whether two periods, specified as numeric vectors of start and end dates, are contemporary with each other:
library("tempo")
#> Loading required package: rlang
period1 <- c(1500, 1900)
period2 <- c(1800, 1950)
contemporary_with(period1, period2)
#> [1] TRUEtempo supports fifteen types of temporal relations following Levy’s
typology (Levy et al. 2021 https://doi.org/10.1016/j.jas.2020.105225;
Levy et al. in press). See ?relations for a list.
By default, comparison of start and end points is inclusive (i.e. using
>= and <=). strict = TRUE enables the ‘strict’ variants of each
relation (i.e. using > and <):
period3 <- c(1900, 1950)
contemporary_with(period1, period3)
#> [1] TRUE
contemporary_with(period1, period3, strict = TRUE)
#> [1] FALSE