Re: [R] choose between dates and times

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Wed 27 Jul 2005 - 06:19:58 EST

Kerry Bush <kerryrekky@yahoo.com> writes:

> Dear R-helpers,
> I have the following data:
>
> y happenat x
> 5185 (07/22/05 00:05:14) 14
> 5186 (07/22/05 00:15:14) 14
> 5187 (07/22/05 00:25:14) 14
> 5188 (07/22/05 00:35:14) 14
> ......
>
> I want to choose between 07/25/05 15:30:00 and
> 07/26/05 12:30:00. Anybody had experience in handling
> this kind of data? Is there a simple way to subset by
> the variable 'happenat'? Thanks.

Simple, perhaps not. This stuff always gets a little heavy, but start here:

> strptime("(07/22/05 00:05:14)",format="(%m/%d/%y %H:%M:%S)") >
+ as.POSIXct("2005-07-22 00:06:00")
[1] FALSE
> strptime("(07/22/05 00:05:14)",format="(%m/%d/%y %H:%M:%S)") >
+ as.POSIXct("2005-07-22 00:05:00")
[1] TRUE Once you figure out how this works, the rest should follow.

-- 
   O__  ---- Peter Dalgaard             ุster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)                  FAX: (+45) 35327907

______________________________________________
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 Jul 27 06:29:20 2005

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