create_schedule accepts a data frame with at least two columns
(tasks and offsets), and replaces the offsets with dates.
Arguments
- schedule_data
A data frame with at least two columns, the first of type character (for tasks) and the second of type integer (for offsets). If a third column is present, it should be of type character (for email addresses).
- starting_month
A character string of the format
yyyy-mmproviding the starting month for the schedule.- iterations
An integer specifying the number of months you wish to schedule. The default is 1.
- filepath
A file name to write to
Value
A tibble() with three columns and length equal to the number of
rows in your data frame multiplied by iterations.
Input data
The first column of your data frame should contain a list of tasks, for
example "Send email reminder" or "Export data". The column doesn't have to
be named task, but it does need to be the first column in the data frame.
The second column of your data frame should contain a list of integers,
which might be positive or negative, that define the number of working days
relative to the first working day of the month. For example, 0 is the first
working day of the month, 1 is the second working day of the month and so
on. Alternatively, -1 is the day before the first working day of the month,
-2 is two days before the first working day of the month etc. The column
doesn't have to be named offset, but it does need to be the second column
in the data frame.
The third column in your data frame, which is optional, should contain a
list of email addresses of individuals to whom the tasks are assigned. If a
task is assigned to more than one individual, you should separate their
email addresses with a semi-colon (;). The column doesn't have to be
named assigned_to, but it does need to be the third column in the data
frame should you choose to include it.
Examples
# Create a calendar of Auckland Council's known non-working days
create_calendar()
# Create a data frame of tasks and offsets
tasks <- data.frame(
tasks = c("Send email reminder", "Extract data", "Run report"),
offsets = c(-2, 0, 1)
)
# Pass the data frame to `create_schedule` to create a schedule for the first
# three months of 2023
create_schedule(
schedule_data = tasks,
starting_month = "2023-01",
iterations = 3
)
#> tasks offsets date
#> 1 Send email reminder -2 2022-12-22
#> 2 Extract data 0 2023-01-09
#> 3 Run report 1 2023-01-10
#> 4 Send email reminder -2 2023-01-27
#> 5 Extract data 0 2023-02-01
#> 6 Run report 1 2023-02-02
#> 7 Send email reminder -2 2023-02-27
#> 8 Extract data 0 2023-03-01
#> 9 Run report 1 2023-03-02