A calendario object tracks a collection of projects that are contain tasks that are to be performed at different times
Methods
Method get_tasks()
Retrieve a table of stored tasks
Examples
cal <- Calendario$new()
cal$set_project("my project")
cal$add_task("first task", "jan 21")
cal$add_task("second task", "jan 22")
cal$get_tasks()
Method set_project()
Set the default project (special case of set_default()
)
Examples
cal <- Calendario$new()
cal$set_project("my project")
cal$get_project()
Method set_defaults()
Set the default value for one or more specified task fields
Examples
cal <- Calendario$new()
cal$set_defaults(type = "fun", team = "danielle")
cal$get_defaults()
Method get_project()
Retrieve the name of the current default project
Examples
cal <- Calendario$new()
cal$set_project("my project")
cal$get_project()
Method get_defaults()
Retrieve the current defaults for all task fields
Examples
cal <- Calendario$new()
cal$get_defaults()
Method add_task()
Add a task to a project
Usage
Calendario$add_task(
description = NULL,
start = NULL,
stop = NULL,
days = NULL,
daily_hours = NULL,
total_hours = NULL,
type = NULL,
project = NULL,
team = NULL
)
Arguments
description
Character string providing a description of the task
start
Date the work starts (defaults to current date)
stop
Date the work stops (defaults to same day as start)
days
Number of weekdays spanned by the task
daily_hours
Number of hours per day the task takes
total_hours
Number of hours in total the task takes
type
Character string assigning the task to a category
project
Character string naming the project the task falls within
team
Character string describing the team
Examples
cal <- Calendario$new()
cal$add_task(
description = "label for the task",
start = as.Date("2025-01-24"),
stop = as.Date("2025-01-26"),
daily_hours = 1,
project = "my project",
team = "just me"
)
cal$get_tasks()
Method show_tasks()
Show a table of stored tasks as a flextable
Examples
cal <- Calendario$new()
cal$set_project("my project")
cal$add_task("first task", "jan 21")
cal$add_task("second task", "jan 23")
cal$show_tasks()
Method get_workload()
Retrieve a table describing daily workload
Arguments
start
Date the tabulation starts (defaults to current date)
stop
Date the tabulation stops (defaults to start date plus 90 days)
Examples
cal <- Calendario$new()
cal$set_project("my project")
cal$add_task("first task", "jan 21")
cal$add_task("second task", "jan 23")
cal$get_workload()
Method get_calendar()
Retrieve a list of tables describing monthly workload
Arguments
start
Date the tabulation starts (defaults to current date)
stop
Date the tabulation stops (defaults to start date plus 90 days)
Examples
cal <- Calendario$new()
cal$set_project("my project")
cal$add_task("first task", "jan 21")
cal$add_task("second task", "jan 23")
cal$get_workload(start = "jan 1", stop = "feb 16")
Method show_calendar()
Show monthly workload as a flextable
Arguments
start
Date the tabulation starts (defaults to current date)
stop
Date the tabulation stops (defaults to start date plus 90 days)
Examples
cal <- Calendario$new()
cal$set_project("my project")
cal$add_task("first task", "jan 21")
cal$add_task("second task", "jan 23")
cal$show_calendar(start = "jan 1", stop = "feb 16")
Method export()
Export to an R script that generates the calendario object
Examples
## ------------------------------------------------
## Method `Calendario$get_tasks`
## ------------------------------------------------
cal <- Calendario$new()
cal$set_project("my project")
cal$add_task("first task", "jan 21")
cal$add_task("second task", "jan 22")
cal$get_tasks()
#> # A tibble: 2 × 9
#> project type description start stop days daily_hours total_hours
#> <chr> <chr> <chr> <date> <date> <int> <dbl> <dbl>
#> 1 my proj… NA first task 2026-01-21 2026-01-21 1 1 1
#> 2 my proj… NA second task 2026-01-22 2026-01-22 1 1 1
#> # ℹ 1 more variable: team <chr>
## ------------------------------------------------
## Method `Calendario$set_project`
## ------------------------------------------------
cal <- Calendario$new()
cal$set_project("my project")
cal$get_project()
#> [1] "my project"
## ------------------------------------------------
## Method `Calendario$set_defaults`
## ------------------------------------------------
cal <- Calendario$new()
cal$set_defaults(type = "fun", team = "danielle")
cal$get_defaults()
#> $project
#> [1] "Project"
#>
#> $type
#> [1] "fun"
#>
#> $description
#> [1] "Description"
#>
#> $days
#> [1] NA
#>
#> $daily_hours
#> [1] 1
#>
#> $total_hours
#> [1] 1
#>
#> $team
#> [1] "danielle"
#>
## ------------------------------------------------
## Method `Calendario$get_project`
## ------------------------------------------------
cal <- Calendario$new()
cal$set_project("my project")
cal$get_project()
#> [1] "my project"
## ------------------------------------------------
## Method `Calendario$get_defaults`
## ------------------------------------------------
cal <- Calendario$new()
cal$get_defaults()
#> $project
#> [1] "Project"
#>
#> $type
#> [1] NA
#>
#> $description
#> [1] "Description"
#>
#> $days
#> [1] NA
#>
#> $daily_hours
#> [1] 1
#>
#> $total_hours
#> [1] 1
#>
#> $team
#> [1] NA
#>
## ------------------------------------------------
## Method `Calendario$get_options`
## ------------------------------------------------
cal <- Calendario$new()
cal$get_options()
#> $flextable_options
#> $flextable_options$theme_fun
#> function (x)
#> {
#> if (!inherits(x, "flextable")) {
#> stop(sprintf("Function `%s` supports only flextable objects.",
#> "theme_alafoli()"))
#> }
#> fp_bdr <- fp_border(width = flextable_global$defaults$border.width,
#> color = flextable_global$defaults$border.color)
#> x <- border_remove(x)
#> x <- bg(x, bg = "transparent", part = "all")
#> x <- color(x, color = "#666666", part = "all")
#> x <- bold(x = x, bold = FALSE, part = "all")
#> x <- italic(x = x, italic = FALSE, part = "all")
#> x <- padding(x = x, padding = 3, part = "all")
#> x <- align_text_col(x, align = "left", header = TRUE)
#> x <- align_nottext_col(x, align = "right", header = TRUE)
#> x <- hline_bottom(x, part = "header", border = fp_bdr)
#> x <- hline_top(x, part = "body", border = fp_bdr)
#> fix_border_issues(x)
#> }
#> <bytecode: 0x55a05cd7dc88>
#> <environment: namespace:flextable>
#>
#> $flextable_options$font.size
#> [1] 8
#>
#> $flextable_options$fmt_date
#> [1] "%a %b %d %Y"
#>
#> $flextable_options$digits
#> [1] 2
#>
#> $flextable_options$background.color
#> [1] "#ffffff"
#>
#>
#> $date_range_start
#> function ()
#> lubridate::today()
#> <bytecode: 0x55a05cd7a9e0>
#> <environment: namespace:calendario>
#>
#> $date_range_stop
#> function (start = NULL, span = 90)
#> {
#> if (is.null(start))
#> return(lubridate::today() + span)
#> start + span
#> }
#> <bytecode: 0x55a05cd76ef8>
#> <environment: namespace:calendario>
#>
#> $date_task_start
#> function ()
#> lubridate::today()
#> <bytecode: 0x55a05cd77470>
#> <environment: namespace:calendario>
#>
#> $date_task_stop
#> function (start = NULL, days = NULL)
#> {
#> if (is.null(start))
#> start <- lubridate::today()
#> if (is.null(days))
#> days <- 0
#> add_weekdays(start, days)
#> }
#> <bytecode: 0x55a05cd77668>
#> <environment: namespace:calendario>
#>
## ------------------------------------------------
## Method `Calendario$add_task`
## ------------------------------------------------
cal <- Calendario$new()
cal$add_task(
description = "label for the task",
start = as.Date("2025-01-24"),
stop = as.Date("2025-01-26"),
daily_hours = 1,
project = "my project",
team = "just me"
)
cal$get_tasks()
#> # A tibble: 1 × 9
#> project type description start stop days daily_hours total_hours
#> <chr> <chr> <chr> <date> <date> <int> <dbl> <dbl>
#> 1 my proj… NA label for … 2025-01-24 2025-01-26 1 1 1
#> # ℹ 1 more variable: team <chr>
## ------------------------------------------------
## Method `Calendario$show_tasks`
## ------------------------------------------------
cal <- Calendario$new()
cal$set_project("my project")
cal$add_task("first task", "jan 21")
cal$add_task("second task", "jan 23")
cal$show_tasks()
Project
Type
Description
Start date
End date
Work days
Daily hours
Total hours
Team
my project
first task
Wed Jan 21 2026
Wed Jan 21 2026
1
1
1
my project
second task
Fri Jan 23 2026
Fri Jan 23 2026
1
1
1
## ------------------------------------------------
## Method `Calendario$get_workload`
## ------------------------------------------------
cal <- Calendario$new()
cal$set_project("my project")
cal$add_task("first task", "jan 21")
cal$add_task("second task", "jan 23")
cal$get_workload()
#> # A tibble: 67 × 6
#> date daily_hours weekday month monthday week
#> <date> <dbl> <ord> <ord> <int> <int>
#> 1 2025-06-26 0 Thu Jun 26 0
#> 2 2025-06-27 0 Fri Jun 27 0
#> 3 2025-06-30 0 Mon Jun 30 1
#> 4 2025-07-01 0 Tue Jul 1 1
#> 5 2025-07-02 0 Wed Jul 2 1
#> 6 2025-07-03 0 Thu Jul 3 1
#> 7 2025-07-04 0 Fri Jul 4 1
#> 8 2025-07-07 0 Mon Jul 7 2
#> 9 2025-07-08 0 Tue Jul 8 2
#> 10 2025-07-09 0 Wed Jul 9 2
#> # ℹ 57 more rows
## ------------------------------------------------
## Method `Calendario$get_calendar`
## ------------------------------------------------
cal <- Calendario$new()
cal$set_project("my project")
cal$add_task("first task", "jan 21")
cal$add_task("second task", "jan 23")
cal$get_workload(start = "jan 1", stop = "feb 16")
#> # A tibble: 33 × 6
#> date daily_hours weekday month monthday week
#> <date> <dbl> <ord> <ord> <int> <int>
#> 1 2026-01-01 0 Thu Jan 1 0
#> 2 2026-01-02 0 Fri Jan 2 0
#> 3 2026-01-05 0 Mon Jan 5 1
#> 4 2026-01-06 0 Tue Jan 6 1
#> 5 2026-01-07 0 Wed Jan 7 1
#> 6 2026-01-08 0 Thu Jan 8 1
#> 7 2026-01-09 0 Fri Jan 9 1
#> 8 2026-01-12 0 Mon Jan 12 2
#> 9 2026-01-13 0 Tue Jan 13 2
#> 10 2026-01-14 0 Wed Jan 14 2
#> # ℹ 23 more rows
## ------------------------------------------------
## Method `Calendario$show_calendar`
## ------------------------------------------------
cal <- Calendario$new()
cal$set_project("my project")
cal$add_task("first task", "jan 21")
cal$add_task("second task", "jan 23")
cal$show_calendar(start = "jan 1", stop = "feb 16")
Month
Days
Mon
Tue
Wed
Thu
Fri
Total
Jan
1-2
0
0
0
5-9
0
0
0
0
0
0
12-16
0
0
0
0
0
0
19-23
0
0
1
0
1
2
26-30
0
0
0
0
0
0
Feb
2-6
0
0
0
0
0
0
9-13
0
0
0
0
0
0
16
0
0