elapsed_months: Get elapsed months between two dates.

Description Usage Arguments Value Examples

View source: R/timer.R

Description

Get elapsed months between two dates.

Usage

1
elapsed_months(start_date, end_date, method = "round")

Arguments

start_date

Start date.

end_date

End date

method

Calculation method:
round: Roundes value according to the number of days elapsed.
max: Only one day in the month is enough to count it.
min: Number of elapsed months using lubridate::period

Value

A numeric value.

Examples

1
2
3
4
5
6
7
8
# All days in a year
timer::elapsed_months(lubridate::dmy("01/01/2000"), lubridate::dmy("31/12/2000"))

# All days in a year + 1
timer::elapsed_months(lubridate::dmy("01/01/2000"), lubridate::dmy("01/01/2001"))

# All days in a year + 1 with max method
timer::elapsed_months(lubridate::dmy("01/01/2000"), lubridate::dmy("01/01/2001"), method = "max")

stephLH/timer documentation built on Dec. 27, 2019, 2:15 p.m.