View source: R/yr_sort_range.R
| yr_earlier_than | R Documentation |
Tests whether years are chronologically earlier or later than each other, accounting for era direction.
yr_earlier_than(x, y)
yr_later_than(x, y)
yr_not_earlier_than(x, y)
yr_not_later_than(x, y)
x, y |
yr vectors with era. If in different eras, |
For forward-counting eras (e.g. CE), yr_earlier_than(x, y) is equivalent to
x < y and yr_later_than(x, y) is equivalent to x > y. For
backward-counting eras (e.g. BP, BCE), the comparisons are reversed.
yr_not_earlier_than() and yr_not_later_than() are the negations of
yr_earlier_than() and yr_later_than(), equivalent to >= and <=
respectively for forward-counting eras.
These are implemented as functions rather than S3 methods for <, >,
<=, and >= to avoid surprises when numerical (i.e. not chronological)
comparison is expected.
A logical vector.
Other functions for chronological ordering and extremes:
yr_difference(),
yr_extremes,
yr_sort()
# Forward-counting era:
x <- yr(c(100, 200, 300), "CE")
yr_earlier_than(x, yr(200, "CE"))
yr_later_than(x, yr(200, "CE"))
yr_not_earlier_than(x, yr(200, "CE"))
yr_not_later_than(x, yr(200, "CE"))
# Backward-counting era:
y <- yr(c(100, 200, 300), "BCE")
yr_earlier_than(y, yr(200, "BCE"))
yr_later_than(y, yr(200, "BCE"))
yr_not_earlier_than(y, yr(200, "BCE"))
yr_not_later_than(y, yr(200, "BCE"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.