GEMINI-Medicine / Rgemini

A custom R package that provides a variety of functions to perform data analyses with GEMINI data
https://gemini-medicine.github.io/Rgemini/
Other
3 stars 0 forks source link

Bugs in stat_holiday_ON #1

Closed loffleraSMH closed 1 year ago

loffleraSMH commented 1 year ago

I identified a few bugs in stat_holiday_ON:

  1. 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.

  2. 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.

  3. 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.

vaakesan-SMH commented 1 year ago

Resolved with #2