Skip to contents

Package overview

datey-package
Exact date and duration arithmetic on an annual grid

Create a datey or durationy

datey() start_day() mid_day() end_day()
Create a datey
durationy()
Create a durationy from an annual duration
seq(<datey>) seq(<durationy>)
Create datey or durationy sequence vector
c(<datey>) c(<durationy>) c(<datey_interval>)
Combine multiple datey, durationy or datey_interval vectors
`[`(<datey>) `[`(<durationy>) `[`(<datey_interval>) `[<-`(<datey>) `[<-`(<durationy>) `[<-`(<datey_interval>)
Subset datey, durationy or datey_interval vectors

Properties of datey and durationy

to_ymdf() `$`(<datey>)
Get year, month, day or day_fraction breakdown of a datey
is_datey() is_datey_interval() is_durationy()
Is x a datey, durationy or datey_interval?
is_start_day() is_mid_day()
Is a datey the start (or end) or middle of a day?
is_leap_year()
Is x a leap year?

Conversion to years

as.double(<datey>) as.integer(<datey>)
Convert a datey to calendar years (including fractional part)
as.double(<durationy>) as.integer(<durationy>)
Convert a durationy to duration in years

Operators and statistics

Ops(<datey_type>)
Operators for datey, durationy and datey_interval
mean(<datey_interval>) mean(<datey>) mean(<durationy>)
Mean value of datey or durationy
Summary(<datey_interval>) Summary(<datey>) Summary(<durationy>)
Minimum, maximum or range of datey or durationy

datey_interval

datey_interval() `%to%`
Create a datey_interval
is_proper() all_proper() is_collapsed() all_collapsed() any_collapsed()
Properties of a datey_interval
`$`(<datey_interval>)
Get the start, end or duration of a datey_interval
interval_includes() `%includes%`
Whether a datey_interval includes a datey
all_of_time
'All of time' — the maximum valid datey_interval

Formatting and printing

NA handling