[Rd] forwarded: bug (?) in cut.POSIXt with "breaks"=integer

Vitalie S. vitosmail at rambler.ru
Sat Oct 17 10:45:10 CEST 2009

On Fri, 16 Oct 2009 16:12:40 +0200, Ben Bolker <bolker at ufl.edu> wrote:

> PS a parallel problem seems to occur in cut.Date  ... cut.POSIXt and  
> cut.Date
> both allow
> breaks to be a single integer specifying the number of breaks, and both  
> call
>  if(is.null(labels)) levels(res) <- as.character(breaks[-length(breaks)])
> near the end of the function, which breaks (so to speak) if
> length(breaks)!=length(levels(res))-1
> I could keep working on a patch if requested, but probably won't  
> otherwise.
I believe it's an important issue. In plotting long time series grouping  
is indispensable.
Thank you, Ben, for working on that.

May I take this opportunity and propose an additional argument "by" to  
"cut" function. This would make cut similar to seq and cut.POSIXt (in the  
latter, intervals as "30 s" are allowed in breaks specification).  
Conceptually it's often simpler to think in terms of the length of  
interval than the number of intervals in "breaks".


>   Ben Bolker

More information about the R-devel mailing list