Create ready to print monthly and yearly calendars. The function allows personalizing colors (even setting a gradient color scale for a full month or year), texts and fonts. In addition, for monthly calendars you can also add text on the days and moon phases.
calendR(
year = format(Sys.Date(), "%Y"),
month = NULL,
from = NULL,
to = NULL,
start = c("S", "M"),
orientation = c("portrait", "landscape"),
title,
title.size = 20,
title.col = "gray30",
subtitle = "",
subtitle.size = 10,
subtitle.col = "gray30",
text = NULL,
text.pos = NULL,
text.size = 4,
text.col = "gray30",
special.days = NULL,
special.col = "gray90",
gradient = FALSE,
low.col = "white",
col = "gray30",
lwd = 0.5,
lty = 1,
font.family = "sans",
font.style = "plain",
day.size = 3,
days.col = "gray30",
weeknames,
weeknames.col = "gray30",
weeknames.size = 4.5,
week.number = FALSE,
week.number.col = "gray30",
week.number.size = 8,
monthnames,
months.size = 10,
months.col = "gray30",
months.pos = 0.5,
mbg.col = "white",
legend.pos = "none",
legend.title = "",
bg.col = "white",
bg.img = "",
margin = 1,
ncol,
lunar = FALSE,
lunar.col = "gray60",
lunar.size = 7,
pdf = FALSE,
doc_name = "",
papersize = "A4"
)
Calendar year. By default uses the current year.
Month of the year or NULL
(default) for the yearly calendar.
Custom start date of the calendar. If from != NULL
, year
and month
arguments won't be taken into account.
Custom end date of the calendar.
"S"
(default) for starting the week on Sunday or "M"
for starting the week on Monday.
The calendar orientation: "portrait"
or "landscape"
(default). Also accepts "p"
and "l"
.
Title of the the calendar. If not supplied is the year and the month, or the year if month = NULL
.
Size of the main title.
Color of the main title.
Subtitle of the calendar in italics (optional).
Font size of the subtitle.
Color of the subtitle.
Character vector of texts to be added on the calendar. Only for monthly calendars.
Numeric vector containing the number of days of the month where to add the texts of the text
argument.
Font size of the texts added with the text
argument.
Color of the texts added with the text
argument.
Numeric vector indicating the days to color or "weekend"
for coloring all the weekends.
Color for the days indicated in special.days. If gradient = TRUE
, is the higher color of the gradient.
Boolean. If special.days
is a numeric vector of the length of the displayed days, gradient = TRUE
creates a gradient of the special.col
on the calendar.
If gradient = TRUE
, is the lower color of the gradient. If gradient = FALSE
is the background color of the days. Defaults to "white"
.
Color of the lines of the calendar.
Line width of the calendar.
Line type of the calendar. If lty = 0
no lines are drawn.
Font family of all the texts.
Style of all the texts and numbers except the subtitle. Possible options are "plain"
(default), "bold"
, "italic"
and "bold.italic"
.
Font size of the number of the days.
Color of the number of the days.
Character vector with the names of the days of the week starting on Monday. By default they will be in the system locale.
Color of the names of the days.
Size of the names of the days.
If TRUE
, the week number of the year for each week is added.
If week.number = TRUE
is the color of the week numbers.
If week.number = TRUE
is the size of the week numbers.
Character vector with the names of the months of the calendar. By default they will be upper case and in the system locale.
Font size of the names of the months.
If month = NULL
, is the color of the month names.
Horizontal align of the month names. Defaults to 0.5 (center).
Background color of the month names. Defaults to "white".
If gradient = TRUE
, is the position of the legend. It can be set to "none"
(default), "top"
, "bottom"
, "left"
and "right"
.
If legend.pos != "none"
and gradient = TRUE
, is the title of the legend.
Background color of the calendar. Defaults to "white".
Character string containing the URL or the local directory of a image to be used as background.
Numeric. Allows controlling the margin of the calendar.
Numeric. Controls the number of columns of the yearly calendar. Overrides the default values for "landscape" and "portrait" orientation.
Boolean. If TRUE
, draws the lunar phases. Only available for monthly calendars.
If lunar = TRUE
, is the color of the hide part of the moons.
If lunar = TRUE
, is the size of the representation of the moons.
Boolean. If TRUE
, saves the calendar in the working directory in A4 format.
If pdf = TRUE
, is the name of the generated file (without the file extension). If not specified, creates files of the format: Calendar_year.pdf
for yearly calendars and Calendar_month_year.pdf
for monthly calendars.
PDF paper size. Possible options are "A6"
, "A5"
, "A4"
(default), "A3"
, "A2"
, "A1"
and "A0"
. Depending on the size you will need to fine-tune some arguments, like the font sizes.
Soage González, José Carlos.
Maintainer: José Carlos Soage González. jsoage@uvigo.es
# Calendar of the current year
calendR()
# Calendar of July, 2005, starting on Monday
calendR(year = 2005, month = 7, start = "M", subtitle = "Have a nice day")
# \donttest{
# Create ready to print monthly calendars for all the months of the current year
# with week starting on Sunday
invisible(sapply(1:12 , function(i) calendR(month = i, pdf = TRUE,
doc_name = file.path(tempdir(), paste0("myCalendar", i , ".pdf")))))
# }
Run the code above in your browser using DataLab