[R] Grouping miliseconds By Hours

Hasan Diwan hasan.diwan at gmail.com
Sun Feb 5 10:54:27 CET 2012


I have a list of numbers corresponding to timestamps, a sample of which follows:
c(1327211358, 1327221999, 1327527296, 1327555433, 1327701042,
1327761389, 1327780993, 1327815670, 1327822964, 1327897497, 1327897527,
1327937072, 1327938300, 1327957589, 1328044466, 1328127921, 1328157588,
1328213951, 1328236836, 1328300276, 1328335936, 1328429102)

I would like to group these into hours. In other words, something like:
c( "2012-01-31 21:14:26 PST" "2012-02-01 20:25:21 PST"
 "2012-02-02 04:39:48 PST" "2012-02-02 20:19:11 PST"
"2012-02-03 02:40:36 PST" "2012-02-03 20:17:56 PST"
"2012-02-04 06:12:16 PST" "2012-02-05 08:05:02 PST")
Hour  Hits
21      1
20      3
4        1
2        1
6        1
8        1

How would I do this without too much pain (from a CPU perspective)?
This is a subset of a million entries and I would rather not go
through these manually... So, any advice? Many thanks! -- H
--
Sent from my mobile device
Envoyait de mon portable



More information about the R-help mailing list