[R] problem with cut(as.Date("2006-08-14"), "week")

Mikkel Grum mi2kelgrum at yahoo.com
Thu Aug 17 21:18:43 CEST 2006


When I run cut.Date or cut.POSIXt with argument breaks
= "weeks", the function gives the first day of that
week, unless the date is the first day of the week, in
which case it gives an error message as in:

> cut(as.Date("2006-08-16"), "week")
[1] 2006-08-14
Levels: 2006-08-14
> cut(as.Date("2006-08-14"), "week")
Error in 1:(1 + max(which(breaks < maxx))) : 
        result would be too long a vector
In addition: Warning message:
no non-missing arguments to max; returning -Inf 
> sessionInfo()
Version 2.3.1 (2006-06-01) 
i386-pc-mingw32 

attached base packages:
[1] "methods"   "stats"     "graphics"  "grDevices"
"utils"     "datasets" 
[7] "base"     
> Sys.getlocale()
[1] "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"
> 

Bug or feature?

Mikkel



More information about the R-help mailing list