Switched the interval convention for datey_interval
from left-closed, right-open [start, end)
to left-open, right-closed (start, end]
for consistency with survival analysis and actuarial exposed-to-risk,
for which a period ending in death should include the time of death.
This means interval %includes% t is now TRUE when
start < t <= end and so code that tests membership at an interval's
start or end will produce different results.
In particular, datey(valid_years_start) is no longer
included in all_of_time but datey(valid_years_end) is.
A datey_interval is now formatted and printed as (start, end].
rep() methods for datey, durationy and datey_interval.
Previously rep() dropped the class and returned bare integer or double
values. As rep_len() and rep.int() fall back to rep() dispatch, they
are fixed too. This also fixes pmax() and pmin(), which previously
returned the wrong values for datey and durationy when arguments
of different lengths were recycled.NA_INTEGER) when parsing durationy
from text in C++. Results are unaffected on conforming hardware.Initial CRAN release.
datey and durationy represent dates and durations on a discrete annual
grid, with exact, associative arithmetic (+, -, comparisons,
mean(), range(), etc.).start_day(), mid_day(), end_day() and datey() map calendar
year/month/day (and day-fraction), fractional years and
Date, POSIXct, POSIXlt to datey.to_ymdf() and $year, $month, $day and $day_fraction provide the
breakdown of a datey into year, month, day and day fraction components.is_start_day() and is_mid_day() provides checking of datey alignment.as.double() and as.integer() provide convenient conversion to numeric
types as years, with mixed number and datey/durationy arithmetic adhering
to the same convention using implicit conversion.NA_datey_, NA_durationy_ and NA_datey_interval_ provide type-correct
NAs, with full is.na()/anyNA() support.datey, durationy and datey_interval.pillar_shaft() methods for readable printing of datey/durationy/
datey_interval columns in tibbles.is_leap_year() for integer years and dateys.datey_interval (constructed with datey_interval() or %to%) represents
a half-open [start, end) date interval. Operations include:
== and != for equality comparison.%includes% (or interval_includes()) to test whether an interval contains
a datey or numeric value.& for intersection: returns an empty collapsed interval for adjacent
intervals, NA_datey_interval_ for non-intersecting non-adjacent intervals.is_collapsed(), is_proper() and related predicates.all_of_time and NA_datey_interval_.seq() is supported for datey and durationy via a by argument
(note: length.out is not supported).