year-month-day-count-between {clock} | R Documentation |
This is a year-month-day method for the calendar_count_between()
generic.
It counts the number of precision
units between start
and end
(i.e., the number of years or months).
## S3 method for class 'clock_year_month_day' calendar_count_between(start, end, precision, ..., n = 1L)
start, end |
A pair of year-month-day vectors. These will be recycled to their common size. |
precision |
One of:
|
... |
These dots are for future extensions and must be empty. |
n |
A single positive integer specifying a multiple of |
"quarter"
is equivalent to "month"
precision with n
set to n * 3L
.
An integer representing the number of precision
units between
start
and end
.
# Compute an individual's age in years x <- year_month_day(2001, 2, 4) today <- year_month_day(2021, 11, 30) calendar_count_between(x, today, "year") # Compute the number of months between two dates, taking # into account the day of the month and time of day x <- year_month_day(2000, 4, 2, 5) y <- year_month_day(2000, 7, c(1, 2, 2), c(3, 4, 6)) calendar_count_between(x, y, "month")