Returns the chronologically earliest and/or latest value in a vector of
years, i.e. era-aware version min(), max(), and range().
Usage
yr_earliest(x, na.rm = FALSE)
yr_latest(x, na.rm = FALSE)
yr_range(x, na.rm = FALSE)
Value
For yr_earliest() and yr_leatest(), a yr vector of length 1 with the
earliest or latest value.
For yr_range(), a yr vector of length 2 with the earliest and latest
value (in that order).
If x contains NA values and na.rm = FALSE (the default), only NAs
will be returned.
Arguments
x
A yr vector with era
na.rm
a logical indicating whether missing values should be removed
Details
These are implemented as prefixed functions rather than S3 min(), max(),
and range() methods for yrs to avoid surprises when numerical (i.e. not
chronological) extremes are expected.
See Also
Other functions for chronological ordering and extremes:
yr_difference(),
yr_earlier_than(),
yr_sort()