library(lubridate, warn.conflicts = FALSE)
start <- "1999-01-01"
end <- "1999-05-01"
# You might want the last day of the month that is either a
# Sunday or a Monday, but you don't want to return both.
# This would return both:
on_last_monday_and_sunday <- monthly() %>%
recur_on_day_of_week(c("Monday", "Sunday"), nth = -1)
alma_search(start, end, on_last_monday_and_sunday)
# To return just the last one, you would select the last value in
# the set, which is computed on a per month basis
on_very_last_monday_or_sunday <- on_last_monday_and_sunday %>%
recur_on_position(-1)
alma_search(start, end, on_very_last_monday_or_sunday)
wday(alma_search(start, end, on_very_last_monday_or_sunday), label = TRUE)
Run the code above in your browser using DataLab