These functions create work schedules for weekday, 4-2, and (5-2)-(5-3)-(6-2)x4-(6-3) schedules between the given start and end dates. Rotating schedules (the latter two) require specification of a starting ("anchor") point for the scheduling calculation; this is supplied using the anchor argument, which is set end start by default. Weekly schedules do not require an anchor point.

schedule_weekdays() defines a Monday-Friday work schedule.

schedule_42() defines a rotating 4 on, 2 off work schedule.

schedule_5623() defines a rotating schedule with the following pattern:

  • 5 on, 2 off

  • 5 on, 3 off

  • 6 on, 2 off

  • 6 on, 2 off

  • 6 on, 2 off

  • 6 on, 2 off

  • 6 on, 3 off

schedule_526264() defines a rotating schedule with the following pattern:

  • 5 on, 2 off

  • 5 on, 2 off

  • 5 on, 2 off

  • 6 on, 2 off

  • (repeat 4 more times...)

  • 5 on, 2 off

  • 5 on, 2 off

  • 5 on, 2 off

  • 5 on, 4 off

schedule_predefined(
  schedule = c("weekdays", "42", "5623", "526254", "custom"),
  start = Sys.Date(),
  end = start + 29L,
  anchor = start,
  cycle = NULL
)

schedule_weekdays(start = Sys.Date(), end = start + 29L, anchor = start)

schedule_42(start = Sys.Date(), end = Sys.Date() + 29L, anchor = start)

schedule_5623(start = Sys.Date(), end = Sys.Date() + 29L, anchor = start)

schedule_526264(start = Sys.Date(), end = Sys.Date() + 29L, anchor = start)

Arguments

schedule

A string indicating the schedule to use. For custom schedules, use schedule = "custom".

start

The start date of the returned schedule; either a string in "YYYY-MM-DD" format or a Date object

end

The end date of the returned schedule; either a string in "YYYY-MM-DD" format or a Date object

anchor

The date from which to start ("anchor") schedule calculations. This can be any valid date; no particular relationship to start or end is needed. It must be either a string in "YYYY-MM-DD" format or a Date object.

cycle

A logical vector defining one scheduling cycle. If named, names are passed to sched_parse_weekday() for standardization of weekday names.

Value

A tibble with columns date (a Date column containing dates between start and end, inclusive), weekday (a character column containing full weekday names), and scheduled (a logical column defining whether a day is schedule ("on") or not ("off"))

Details

These functions depend on the more general schedule() function, which takes an arbitrary weekly or rotating schedule and (if needed) an anchor point. See that function for implementing other schedules.

See also