Skip to contents

Export a monthly calendar as pdf

Usage

monthly_calendar(
  year = format(Sys.Date(), "%Y"),
  month = format(Sys.Date(), "%m"),
  path = getwd(),
  filename = NULL,
  title = NULL,
  events = NULL,
  weekend = TRUE,
  palette = "#333333",
  lang = NULL,
  holidays = NULL,
  moon = FALSE,
  specials = NULL
)

Arguments

year

either an integer or a character of length 1. Must have 4 characters (e.g. '2024' and not '24'). Default is the current year.

month

either an integer or a character of length 1. Must have 1 or 2 characters (e.g. '01' or '1'). Default is the current month.

path

a character of length 1. The directory to save the pdf file. Must exist. Default is the current directory.

filename

a character of length 1. The name of the pdf file. Default is calendar-YYYY-MM.pdf (e.g. calendar-2024-04.pdf).

title

a character of length 1. The title of the calendar. Default is Month YYYY (e.g. April 2024).

events

an optional data.frame with the following columns: name, the name of the event, from, the starting date of the event, to, the ending date of the event, and category, the category of the event.

weekend

a logical. If TRUE (default) keeps Saturdays and Sundays.

palette

a character vector of colors for the events. If only one color is provided (default), all events will have this color. If several colors are provided, the number of colors in palette must be equal to the total number of event categories (duplicated colors are accepted). Moreover, the palette argument must be a named vector, where names match event categories. For example, let's that the events object contains two categories (cat_a and cat_b), the palette argument must be equal to palette = c("cat_a" = "black", "cat_b" = "red").

lang

a character of length 1. Used to change the default locale (i.e. the language). Default is NULL (i.e. use the current locale). Depending on the OS and the locale, the output can be weird.

holidays

an optional data.frame with the following columns: date, the date of the holiday, and name, the name of the holiday. Typically, the output of get_holidays(). Default is NULL.

moon

a logical. If TRUE adds new/full moon glyph. Default is FALSE.

specials

an optional data.frame with the following columns: date, the date of the special day, and name, the name of the special day. These special days will be added at the top of the day box. Default is NULL.

Value

No return value. The calendar will exported as a pdf file in path.

Examples

if (FALSE) {
## Add an example ----
}