Discrete linear time values represent a closed interval spanning their
chronon (e.g. year(2020) spans every instant from the start of 2020 to
the end of 2020), while continuous linear time values represent a single
instant. Comparing two mt_linear vectors therefore compares the
start/end instants of the (possibly zero-width) interval each value
represents:
a == biffstart(a) == start(b)andend(a) == end(b)a < biffend(a) <= start(b)(i.e. before with or without a gap)a > biffstart(a) >= end(b)(i.e. after with or without a gap)a <= biffend(a) <= end(b)(right-bound comparison)a >= biffstart(a) >= start(b)(left-bound comparison)
This is not a total order for comparisons between time points at different
granularities: <=/>= are not shorthand for (< or ==)/(> or ==).
For example, yearquarter("2020 Q3") <= year("2020") is TRUE despite
yearquarter("2020 Q3") < year("2020") and
yearquarter("2020 Q3") == year("2020") being FALSE.
The inequality operators </> and <=/>= are useful conjugations of
Allen's interval algebra for common data manipulation needs. The complete set
of Allen's 13 base relations are documented in allen-interval-algebra.
Usage
# S4 method for class 'mt_linear'
e1 == e2
# S4 method for class 'mt_linear'
e1 != e2
# S4 method for class 'mt_linear'
e1 < e2
# S4 method for class 'mt_linear'
e1 <= e2
# S4 method for class 'mt_linear'
e1 > e2
# S4 method for class 'mt_linear'
e1 >= e2Arguments
- e1, e2
mt_linearvectors (or values castable to one, such as plain numeric vectors in the other operand's chronon, read from its epoch asmixtime()reads them, soyear(x) == 2026Lcompares with 2026).