Calculates time difference from dates as fraction of years. Small error possible because using average of 365.25 days/year for calculation. [Stable]

yr_frac(dates, start = "1995-01-01")

Arguments

dates

vector or single date as character ("%Y-%m-%d"-format) or POSIXct or Date

start

Reference date as character ("%Y-%m-%d"-format) or POSIXct or Date. Can be later than dates - returns negative values.