# Using default `since` (1900-01-01, a Monday)
on_weekly_mondays <- weekly()
start <- "1999-01-01" # <- a Friday
end <- "1999-03-01"
# This finds the first Thursday, and then continues from there
alma_search(start, end, on_weekly_mondays)
# We start counting from a Friday here
on_weekly_fridays <- weekly(since = start)
alma_search(start, end, on_weekly_fridays)
# Alternatively, we could use `recur_on_wday()` and force a recurrence rule
# on Friday
on_wday_friday <- on_weekly_mondays %>% recur_on_wday("Friday")
alma_search(start, end, on_wday_friday)
# At monthly frequencies, you can use n-th values to look for particular
# week day events
on_first_friday_in_month <- monthly() %>% recur_on_wday("Fri", 1)
alma_search(start, end, on_first_friday_in_month)
# Negative values let you look from the back
on_last_friday_in_month <- monthly() %>% recur_on_wday("Fri", -1)
alma_search(start, end, on_last_friday_in_month)
# At yearly frequencies, this looks for the first sunday of the year
on_first_sunday_in_year <- yearly() %>% recur_on_wday("Sunday", 1)
alma_search(start, end, on_first_sunday_in_year)
# Last week day of the month
last_weekday_of_month <- monthly() %>%
# Last occurrence of each weekday in the month
recur_on_wday(c("Mon", "Tue", "Wed", "Thu", "Fri"), -1) %>%
# Now choose the last one of those in each month
recur_on_position(-1)
alma_search(start, end, last_weekday_of_month)
Run the code above in your browser using DataLab