Re: [R] cut.Date functionality for chron date/time objects

From: Sebastian Luque <spluque_at_gmail.com>
Date: Wed 03 Aug 2005 - 10:55:34 EST

Gabor Grothendieck <ggrothendieck@gmail.com> wrote:
> Assuming, as in your post:
>
> set.seed(123)
> mychron <- chron(sort(runif(10, 0, 10)))
> breaks <- quantile(mychron)
>
> # is one of these adequate?
>
> cut(mychron, breaks)
>
> cut(unclass(mychron), unclass(breaks), lab = FALSE)

Thank you Gabor, that showed me I really needed to be more creative with the 'breaks' argument. So what I needed was (with mychron as above):

breaks <- seq(min(mychron, na.rm = TRUE),

              ceiling(max(mychron, na.rm = TRUE)), by = 1/2)

cut(unclass(mychron), unclass(breaks),

    include.lowest = TRUE, labels = FALSE)

in order to cut the chron object into 1/2 day units.

Thanks so much,

-- 
Sebastian P. Luque

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Wed Aug 03 11:01:21 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:39 EST