Join GitHub today
week() function returns a 6 day week at the beginning of a year #251
There is a bug in the week() function which leads to the first week of the year being only 6 days long. For example, if you type
x <- seq(from = ymd("2014-01-01"), to = ymd("2014-01-10"), by = "days") week(x)
then you'll get
function(x) yday(x) %/% 7 + 1
function(x) (yday(x) - 1) %/% 7 + 1
I confirm there is an issue with the week() function. The week starts on Tuesday and ends on Monday.
I don't think that the behavior mentioned by IamGianluca is actually a bug. The
"Weeks is the number of complete seven day periods that have occurred between the date and January 1st, plus one."
Thus, the weeks returned by