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

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Wed 03 Aug 2005 - 11:45:15 EST

How about the following:

 > set.seed(123)
 > mychron <- chron(sort(runif(10, 0, 10)))
 > (breaks <- chron(pretty(quantile(mychron))))
[1] 01/01/70 01/03/70 01/05/70 01/07/70 01/09/70 01/11/70  >
spencer graves

Sebastian Luque wrote:

> 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,
-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

spencer.graves@pdf.com
www.pdf.com <http://www.pdf.com>
Tel:  408-938-4420
Fax: 408-280-7915

______________________________________________
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:49:53 2005

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