[R] Alternative to extended recode sintax? Bug?

Uwe Ligges ligges at statistik.tu-dortmund.de
Sun Dec 19 18:14:07 CET 2010



On 19.12.2010 13:20, David Winsemius wrote:
>
> On Dec 19, 2010, at 5:11 AM, Luca Meyer wrote:
>
>> Something goes wrong with the week function of the lubridate package:
>>
>>> x= as.POSIXct(factor(c("2010-12-15 17:28:27",
>> + "2010-12-15 17:32:34",
>> + "2010-12-15 18:48:39",
>> + "2010-12-15 19:25:00",
>> + "2010-12-16 08:00:00",
>> + "2010-12-16 08:25:49",
>> + "2010-12-16 09:00:00")))
>>> require(lubridate)
>
>>> weekdays(x)
>> [1] "Mercoledì" "Mercoledì" "Mercoledì" "Mercoledì" "Giovedì"
>> "Giovedì" "Giovedì"
>>> week(x)
>> [1] 50 50 50 50 51 51 51
>
> But 2010-12-15 is a Wednesday and 2010-12-16 is a Thursday.
>


Together with the description of ?week this shows that lubridate's 
week() function works as documented rather than as expected by Luca Meyer.

Uwe Ligges



More information about the R-help mailing list