-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for varying first week of the year #31
Comments
Hi @ffinger, Thank you for pointing this out. The way {aweek} works is that it looks for the first week that contains at least four days of the new year, otherwise, it is the last week of the previous year. I'm afraid that I do not have much time to implement an alternative definition at the moment (I'm currently moving jobs and do this voluntarily now). Can you point me to some documentation that defines these different week definitions? |
Hi @zkamvar, yes, I am aware that you do this voluntarily now, I mainly wanted to document the issue and start a discussion about the possible solutions. All the better if you have time to start implement things, but feel free to say no. The isoweek definition (week 1 is the week of the first Thursday in a year) is equivalent to yours (first week that contains 4 days of the new year. For the CDC epiweek it's the same. The other definitions I was talking about are unfortunately not standardized and depend on the country, the implementing agency or even the dataset. This is why I would go with a fully flexible framework if possible, keeping the current definition as the standard. I would suggest to implement two alternative ways of defining the first week:
What do you think? |
This package conveniently handles week to date and date to week conversions with varying definitions of the first day in each week.
In epidemiology we are also confronted with varying definitions of week 1 in a year. The ISO norm says: "week 01 is the week with the Gregorian year's first Thursday in it", the week before being week 52 or 53 of the previous year.
https://en.wikipedia.org/wiki/ISO_week_date#First_week
There is however situations in which week 1 is defined as the week containing 1st January, which is not always the same as above. Other definitions are also possible, e.g. the week containing the first Monday, Tuesday, ... Sunday of a year.
It would be great to add an option to choose which of these definitions should be used, with a default to the definition used by ISO.
The text was updated successfully, but these errors were encountered: