laresbernardo / lares

Analytics & Machine Learning R Sidekick
https://laresbernardo.github.io/lares/
233 stars 49 forks source link

Getting holidays data with the function 'holidays' from the online so… #47

Closed Patrikios closed 1 year ago

Patrikios commented 1 year ago

…urce 'https://www.timeanddate.com/holidays/' in a different locale then English, for instance German, was ending up in deformed table, even emtpy table.

The reason was that the HTTP response was in the user (e.g German) locale, and the date parsing was flawed/tricky.

The bug was solved by setting GET header to only accept english based responses.Then pasrsing date with lubridates from English should work as expected.

laresbernardo commented 1 year ago

This seems like a smart solution. Thanks for the PR @Patrikios
Left a comment if you're willing to add the quiet parameter and will be ready to merge. Thanks again.

laresbernardo commented 1 year ago

Lastly, I think you missed running devtools::document() to update roxygen's docs.

Patrikios commented 1 year ago

Yes, that is right, ran the documentation function in the 4th commit.

laresbernardo commented 1 year ago

Can you please fix the following issue?

❯ checking R files for non-ASCII characters ... WARNING Found the following file with non-ASCII characters: onehotencoding.R Portable packages must use only ASCII characters in their R code, except perhaps in comments. Use \uxxxx escapes for other characters.

laresbernardo commented 1 year ago

There's still an error on the examples. Check:

holidays(countries = "Argentina")

Only allowing ± 5 years from today: ‘2023’ Extracting Argentina's holidays for 2023

Error in holidays(countries = "Argentina") : Function 'holidays': Unaccounted problem(s) occured parsing the date column 'holidays$Date'. Please contact the 'lares' package maintainer!
Patrikios commented 1 year ago

Typo corrected, however cannot reproduce the error on examples, look here: image

Can you provide more clues on what is failing cocretely? I tried to set different locals, like Polish and French, and the function executes as expected.

*I noticed that the run did not succeed on Linux and Mac. I am n windows. Is it related to the issue like for instance EOF in git for Windows and UNIX type of systems??

Patrikios commented 1 year ago

Thanks for merge. I tested on Debian 10 just now, the functionality for function holidays corresponds the desire. When running Check some other pointer is being given, if you wanna have a look: image