![]() ![]() I provided a link to my simple geneorama anycodings_week-number package, but please don't rely on it too anycodings_week-number much because it's likely to change and anycodings_week-number not very documented. but I haven't anycodings_week-number done that yet. anycodings_week-number The best way to do this would be to add anycodings_week-number an offset to the offset. Of course, you can easily change the anycodings_week-number offset to make Monday first or whatever. Offset <- data.table(weekday = c('Sunday', 'Monday', 'Tuesday', 'Wednesday', My workaround is this anycodings_week-number function: I day weekday day_rounded weekday_rounded weeknumber # This seems to make internal sense with the "week" calculation # Now let's add the weekdays for the "rounded" dateĭt I don't understand the anycodings_week-number internal mechanics, but you can see what anycodings_week-number I mean with this example: library(data.table) ![]() I think the problem is that the week anycodings_week-number calculation somehow uses the first day anycodings_week-number of the year. So this anycodings_week-number function has the same problem (?). WEEK NUMBER FOR 2014 CODENB: You are using week(.) in the anycodings_week-number data.table package, which is the same anycodings_week-number code as lubridate::week except it anycodings_week-number coerces everything to integer rather anycodings_week-number than numeric for efficiency. The code anycodings_week-number should (?) be (yday(x)-1)%/%7 + 1 WEEK NUMBER FOR 2014 PLUSWeeks is the number of complete seven anycodings_week-number day periods that have occured between anycodings_week-number the date and January 1st, plus one.īut since Jan 1 is the first day of the anycodings_week-number year (not the zeroth), the first "week" anycodings_week-number will be a six day period. Hopefully someone will anycodings_week-number jump in and explain why I am wrong. Actually, I think you may have anycodings_week-number discovered a bug in the week(.) anycodings_week-number function, or at least an error in the anycodings_week-number documentation. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |