Package: datey 0.1.0

Tim Gordon

datey: Exact Date and Duration Arithmetic on an Annual Grid

Standardised mapping of dates onto a discrete annual grid, together with exact date and duration arithmetic. This matters when the primary unit is years but the input data uses dates. Examples are actuarial mortality experience analysis and valuation of life assurance and annuities, for which mortality rates are defined per year but experience and valuation data are typically defined using dates.

Authors:Tim Gordon [aut, cre]

datey_0.1.0.tar.gz
datey_0.1.0.tar.gz(r-4.7-arm64)datey_0.1.0.tar.gz(r-4.7-x86_64)datey_0.1.0.tar.gz(r-4.6-arm64)datey_0.1.0.tar.gz(r-4.6-x86_64)
datey_0.1.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
datey/json (API)

# Install 'datey' in R:
install.packages('datey', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/logmu-org/r-datey/issues

Pkgdown/docs site:https://r-datey.logmu.org

Uses libs:
  • c++– GNU Standard C++ Library v3

On CRAN:

Conda:

cpp

3.18 score 28 exports 1 dependencies

Last updated from:64c18c6813. Checks:6 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK136
linux-devel-x86_64OK143
source / vignettesOK198
linux-release-arm64OK145
linux-release-x86_64OK133
wasm-releaseOK123

Exports:%includes%%to%all_collapsedall_of_timeall_properany_collapseddateydatey_intervaldurationyend_dayinterval_includesis_collapsedis_dateyis_datey_intervalis_durationyis_leap_yearis_mid_dayis_properis_start_daymid_dayNA_datey_NA_datey_interval_NA_durationy_start_dayto_ymdfvalid_duration_years_maxvalid_years_endvalid_years_start

Dependencies:cpp11

Get started with datey
The core types | Creating a datey | When in the day? | From year, month and day | From base R dates | From fractional years or text | Properties of a datey | Creating a durationy | Comparisons and arithmetic | datey_interval -- representing a time period | Interval membership testing | Interval properties | Intersection | NA values | Sequences and statistics

Last update: 2026-07-07
Started: 2026-07-07

The datey specification
Introduction | Definitions | The fixed precision annual grid | Types | Dates | Durations | Mapping years to a datey or durationy | Mapping a date to a datey | Mapping a datey to a date and day-fraction | Arithmetic and comparative operations | Pure datey and duration operations | Mixed datey / durationy and numeric operations | Text representations | datey text format | durationy text format

Last update: 2026-07-07
Started: 2026-07-07

Why datey?
The unit is years, but the data are dates | The datey approach: a fixed annual grid | Interval algebra for rate periods | Standardised day-fractions for exposure calculations | What datey deliberately leaves out

Last update: 2026-07-07
Started: 2026-07-07

Readme and manuals

Help Manual

Help pageTopics
'All of time' — the maximum valid 'datey_interval'all_of_time
Convert a 'datey' to calendar years (including fractional part)as.double.datey as.integer.datey as_years_datey
Convert a 'durationy' to duration in yearsas.double.durationy as.integer.durationy as_years_durationy
Combine multiple 'datey', 'durationy' or 'datey_interval' vectorsc.datey c.datey_interval c.durationy combine
Create a 'datey'datey datey.character datey.Date datey.datey datey.default datey.double datey.integer datey.POSIXct datey.POSIXlt end_day mid_day start_day
Get year, month, day or day_fraction breakdown of a 'datey'$.datey datey_components to_ymdf
Create a 'datey_interval'%to% datey_interval datey_interval.datey datey_interval.datey_interval datey_interval.default datey_interval.double datey_interval.integer datey_interval.logical
Create a 'durationy' from an annual durationdurationy durationy.character durationy.datey_interval durationy.default durationy.double durationy.durationy durationy.integer
Integer constantsinteger_constants valid_duration_years_max valid_years_end valid_years_start
Whether a 'datey_interval' includes a 'datey'%includes% interval_includes
Properties of a 'datey_interval'all_collapsed all_collapsed.datey_interval all_collapsed.default all_proper all_proper.datey_interval all_proper.default any_collapsed any_collapsed.datey_interval any_collapsed.default interval_nature is_collapsed is_collapsed.datey_interval is_collapsed.default is_proper is_proper.datey_interval is_proper.default
Get the start, end or duration of a 'datey_interval'$.datey_interval interval_properties
Is 'x' a leap year?is_leap_year is_leap_year.Date is_leap_year.datey is_leap_year.default is_leap_year.double is_leap_year.integer is_leap_year.POSIXct is_leap_year.POSIXlt
Whether 'datey', 'durationy' or 'datey_interval' are NAanyNA.datey anyNA.datey_interval anyNA.durationy is.na.datey is.na.datey_interval is.na.durationy is_NA
Is 'x' a 'datey', 'durationy' or 'datey_interval'?is_datey is_datey_interval is_durationy is_type
Is a 'datey' the start (or end) or middle of a day?is_mid_day is_start_day is_xxx_day
Minimum, maximum or range of 'datey' or 'durationy'max_min Summary.datey Summary.datey_interval Summary.durationy
Mean value of 'datey' or 'durationy'mean mean.datey mean.datey_interval mean.durationy
The 'datey', 'durationy' and 'datey_interval' versions of NANAs NA_datey_ NA_datey_interval_ NA_durationy_
Operators for 'datey', 'durationy' and 'datey_interval'ops Ops.datey_type
Create 'datey' or 'durationy' sequence vectorseq seq.datey seq.durationy
Subset 'datey', 'durationy' or 'datey_interval' vectorssubset [.datey [.datey_interval [.durationy [<-.datey [<-.datey_interval [<-.durationy
Format or print a 'datey'as.character.datey format.datey print.datey text_from_datey
Format or print a 'datey_interval'as.character.datey_interval format.datey_interval print.datey_interval text_from_datey_interval
Format or print a 'durationy'as.character.durationy format.durationy print.durationy text_from_durationy