When trying to run the function, the following error message is shown:
Error in UseMethod("weekdays") :
no applicable method for 'weekdays' applied to an object of class "character"
The problem can be solved by defining all dates using as.Date() instead of as.character() to provide the correct inputs for the weekdays() function.
The "New Years Day" and "Family Day" labels got switched up (due to this line where family_day is put first):
c(family_day, as.character(holiday(years, holidays[-2])) whereas the "Family Day" label comes 2nd in the list of holiday names.
The returned output table returns more rows than the original input table when include_observed_holidays == TRUE. This is because of years where Christmas Day falls on a Sunday. The observed holiday is moved to Monday, which also happens to be Boxing Day. This results in those Mondays being matched with 2 different holidays when merging, causing additional rows in the output.
I identified a few bugs in
stat_holiday_ON
:When trying to run the function, the following error message is shown:
The problem can be solved by defining all dates using
as.Date()
instead ofas.character()
to provide the correct inputs for theweekdays()
function.The "New Years Day" and "Family Day" labels got switched up (due to this line where
family_day
is put first):c(family_day, as.character(holiday(years, holidays[-2]))
whereas the "Family Day" label comes 2nd in the list of holiday names.The returned output table returns more rows than the original input table when
include_observed_holidays == TRUE
. This is because of years where Christmas Day falls on a Sunday. The observed holiday is moved to Monday, which also happens to be Boxing Day. This results in those Mondays being matched with 2 different holidays when merging, causing additional rows in the output.