Creates a schedule of events occuring before or after either a certain date or another scheduled event.

after(start_event, within_given = NULL)

before(end_event, within_given = NULL)

in_between(start_event, end_event, within_given = NULL)

on_or_after(start_event, within_given = NULL)

on_or_before(end_event, within_given = NULL)

Arguments

start_event, end_event

The start and/or end events of the schedule. Can be either:

  • A date-time object or

  • A schedule.

within_given

Required only when either start_date or end_date is a schedule. Can be either:

  • A string shortcut for a period type: either "day", "week", "month", "quarter" or "year". Or,

  • A date accessor function. Eg. lubridate::month().

Value

A schedule object.

Details

When start_event and/or end_event are schedules they are likely to come around every year. To have any events which can occur 'before' or 'after' them, they need a limit specified by the within_given argument. This can either be date accessor function like lubridate::month() or lubridate::year() or the provided character shortcuts "day", "week", "month", "quarter" or "year".

Examples

christmas <- only_occur(in_month("Dec"), on_mday(25)) new_years_eve <- only_occur(in_month("Dec"), on_mday(31)) after_christmas <- after(christmas, within_given = "year") schedule_days(after_christmas, from = 2000, to = 2001)
#> [1] "2000-12-26" "2000-12-27" "2000-12-28" "2000-12-29" "2000-12-30" #> [6] "2000-12-31" "2001-12-26" "2001-12-27" "2001-12-28" "2001-12-29" #> [11] "2001-12-30" "2001-12-31"
in_between_christmas_and_new_years_eve <- in_between(christmas, new_years_eve, within_given = lubridate::year) schedule_days(in_between_christmas_and_new_years_eve, from = 2000, to = 2001)
#> [1] "2000-12-26" "2000-12-27" "2000-12-28" "2000-12-29" "2000-12-30" #> [6] "2001-12-26" "2001-12-27" "2001-12-28" "2001-12-29" "2001-12-30"