[R] Frequency Counts per Time Period

William Doane wd213355 at albany.edu
Fri Apr 10 22:57:55 CEST 2009


So, to complete Bill Dunlap's thought and combine it with your desired goal,
I believe this gets you what you wanted...

start.time <- as.POSIXct("2009-04-10 12:00:00")
event.times <- start.time + c(1,2,3,61,62,122,135,200)
event.values <- rnorm(length(event.times))
et <- data.frame(event.times,event.values)
et$trunc.times <- as.POSIXct(trunc(event.times, units="mins")) 
data.frame(table(et$trunc.times))

                 Var1 Freq
1 2009-04-10 12:00:00    3
2 2009-04-10 12:01:00    2
3 2009-04-10 12:02:00    2
4 2009-04-10 12:03:00    1


-Wil Doane
-- 
View this message in context: http://www.nabble.com/Frequency-Counts-per-Time-Period-tp22992862p22994500.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list