Skip to content
Prev 245454 / 398503 Next

Alternative to extended recode sintax? Bug?

On Dec 20, 2010, at 10:58 AM, Luca Meyer wrote:

            
Are you saying it shifts within the year? I am not seeing that:

require(lubridate)

 > weekdays(as.POSIXct("2010-01-01")+(0:8)*24*60*60)
[1] "Friday"    "Saturday"  "Sunday"    "Monday"    "Tuesday"    
"Wednesday"
[7] "Thursday"  "Friday"    "Saturday"
 > week(as.POSIXct("2010-01-01")+(0:8)*24*60*60)
[1] 1 1 1 1 1 1 2 2 2

Looks to be incrementing weeks between Wed and Thurs at the beginning  
of the year just as it did in your example. I admit that I thought  
that it should be shifting at the Thursday - Friday divide, but  
setting a zero point can be ambiguous. I thought if it were  Midnight  
Thursday-Friday that all of Thurdays would be in week 1. But at least  
it appears consistent.
David Winsemius, MD
West Hartford, CT