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
Week rounding #747
Comments
Sorry, I realized that I made a mistake in my first logic... It's been a long day. I meant to post this logic:
Which results in this outcome:
|
Dint go through the post in detail yet. But seems like it may be related to http://stackoverflow.com/a/22440145/559784. Could you verify? |
I think they're talking about the function |
BTW, I know that |
This is probably a feature request.
I noticed that when I'm rounding IDates by week there's a problem where the end of one year and the beginning of the next year will get rounded into two different weeks.
The issue is that the week rounding considers the first day of the year to be the day to which all weeks in that year are rounded. I don't know if this is in the data.table code or somewhere else. Since week rounding doesn't exist for POSIX dates, I'm guessing that it's another smart data.table innovation.
Please note: I'm suggesting that calculating
week
, e.g.week(dd)
is different thanround(dd, 'weeks')
and could have a different logic. I think the currentround
works likeweek
, but it should be different.I would expect and argue that we should round to the same weekday regardless of whether the week overlaps across two years. Personally, I don't care about EU / US standards, and any weekday is fine. It would be trivial to add an offset that would shift which day was the rounding day.
Here's my implementation of a work around and an example of the problem:
EDIT: I realized that this is a mistake... please see changes below !!
Thank you,
Gene
PS: I know I've posted two things today, but it's just a coincidence. Please don't worry about me creating tons of posts.
The text was updated successfully, but these errors were encountered: