Find the last day of the month for a given date
Arguments
- date
a vector of dates
Value
the last day of the month that given dates fall in
Examples
date <- as.Date("2020-12-28")
last_day(date)
#> [1] "2020-12-31"
last_day("2020-02-15")
#> [1] "2020-02-29"
last_day("2019-02-15")
#> [1] "2019-02-28"
last_day(c("2020-12-28", "2020-02-15", "2019-02-15"))
#> [1] "2020-12-31" "2020-02-29" "2019-02-28"