[R] Bug in cut.POSIXt

Vitalie S. vitosmail at rambler.ru
Thu Oct 15 17:47:48 CEST 2009


Hello Everyone,

Before reporting decided to post here first:


tt <- structure(c(1254238817, 1254238859, 1254238969, 1254239080), class =  
c("POSIXt",
                                                              "POSIXct"),  
tzone = "")

cut.POSIXt(tt, 2)
#Error in `levels<-.factor`(`*tmp*`, value = character(0)) :
#  number of levels differs

cut.POSIXt(tt, 2, labels=c("a1", "a2"))
#[1] a1 a1 a2 a2
#Levels: a1 a2


cut(tt, "2 mins")
#[1] 2009-09-29 17:40:00 2009-09-29 17:40:00 2009-09-29 17:42:00  
2009-09-29 17:44:00
#Levels: 2009-09-29 17:40:00 2009-09-29 17:42:00 2009-09-29 17:44:00



> sessionInfo()
R version 2.9.2 Patched (2009-09-24 r50069)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United  
States.1252;LC_MONETARY=English_United  
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  utils     datasets  grDevices methods   base
>

Vitalie.




More information about the R-help mailing list