R-CoderDotCom / calendR

Ready to print calendars with ggplot2
https://r-coder.com/calendar-plot-r/
MIT License
255 stars 35 forks source link

No element of the 'special.days' vector can be greater than the number of days of the corresponding month or year #7

Closed R-CoderDotCom closed 4 years ago

R-CoderDotCom commented 4 years ago

Solved

PiyushDahal commented 2 years ago

This issue is still there. For the monthly calendar heatmap, If there is any value greater than no of days of that month in data, then it gives an error message as

"No element of the 'special.days' vector can be greater than the number of days of the corresponding month or year"

RandomAnass commented 1 year ago

@PiyushDahal This is because calendR restricts the values to be smaller than 365. The solution is to normalize the input:

# scale data for year calendar
scale_data <- function(x) {                            
 365* ((x - min(x)) / (max(x) - min(x)))
}

For a month you will have to change the constant 365.