[R] choose between dates and times
bogdan romocea
br44114 at gmail.com
Tue Jul 26 22:16:05 CEST 2005
If happenat is not a datetime value, convert it with strptime(). Then,
one solution is to transform it in the following way:
num.time <- as.numeric(format(happenat,"%Y%m%d%H%M%S"))
This way, 07/22/05 00:05:14 becomes 20050722000514, and you can subset
your data frame with
dfr[which(num.time >= 20050725153000 & num.time <= 20050726123000),]
hth,
b.
> -----Original Message-----
> From: Kerry Bush [mailto:kerryrekky at yahoo.com]
> Sent: Tuesday, July 26, 2005 3:54 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] choose between dates and times
>
>
> 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.
>
> ______________________________________________
> R-help at 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
>
More information about the R-help
mailing list