Hello Everyone,
Thank you in advance for your help it is much appreciated.
I am currently using the CalendR package to create a year calendar and a calendar for each month.
I have the following data frame example:
'''
team <- c("A", "A", "A", "A", "A", "A", "A", "A", "A", "A")
opponent <- c("B", "C", "D", "B", "D", "C", "D", B", "B", "D")
opponentHA <- c("@B", "C", "@D", "@B", "@D", "C", "D", B", "@B", "D")
dayofyear <- c(16, 69, 69, 88, 103, 121, 154, 176, 182, 202)
###this is the day of year with October 1, 2021 set as Day 1
ranking <- c(-3, 2, 2, -1, 0, 3, 0, -3, 2, 1)
df <- data.frame(dayofyear, team, opponent, opponentHA, ranking)
'''
Using CalendR I would like a yearly calendar from October 1, 2021 to March 31, 2022 where each of the dates in the df is
- indicated with a red to green color gradient (ranking = -3 (red), ranking = 3 (green))
This goal has caused me some trouble primarily due to difficulties adding a gradient based on the df$ranking values associated with each date.
My calendR code is below:
'''
calendR(start_date = "2021-10-01",
end_date = "2022-04-30",
start = "M",
mbg.col = 1,
months.col = "white",
special.days = df$dayofyear,
gradient = TRUE,
special.col = "#0A8007", # Color highest value special day = green
low.col = "red",
lty = 0,
weeknames = c("Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"),
title = "Oct - May 2021",
subtitle = "Gradient Based on Ranking",
title.size = 40,
subtitle.size = 20,
orientation = "l")
'''
from this code I receive an error stating that
"Error in calendR(start_date = "2021-10-01", end_date = "2022-04-30", start = "M", :
If gradient = TRUE, the length of 'special.days' must be the same as the number of days of the corresponding month or year"
Based on this error, this is extremely inconvenient considering I would like to apply a gradient to individual dates not every date on the calendar. Is there a better alternative to CalendR keeping in mind that I need this calendar to be very visually appealing.
Thank you very much for you help! It is much appreciated. I look forward to chatting with you.