I'm looking for a quicker way to roll a date to the end of the given month. Currently it takes two functions, ceiling_date and subtracting days.
library(lubridate)
date_1 <- ymd("2020-01-15")
# rollback is simple and great
rollback(date_1)
rollback(date_1, roll_to_first = TRUE)
# but rolling forward looks a little clunky
ceiling_date(date_1, unit = "month") - days(1)
>"2020-01-31"
# maybe add an option to rollback?
rollback(date_1, roll_to_last = TRUE)
>"2020-01-31"
# or create a new function?
rollforward(date_1)
>"2020-01-31"
I'm looking for a quicker way to roll a date to the end of the given month. Currently it takes two functions,
ceiling_dateand subtractingdays.