How do I group by hour and count number of entries in each bin using R -


sample of data imported form csv file:

1 24/05/2014 00:15
2 24/05/2014 00:17
3 24/05/2014 00:17
4 24/05/2014 00:17
5 24/05/2014 01:40
6 24/05/2014 01:48

i group hour , have group count in r, eg.

date count
24/05/2014 00:00 4
24/05/2014 01:00 2

would appreciate help!

thanks

here example

db <- data.frame(time =  sys.time() + seq(1, 10000, = 100),                  counter = 1)  res <- aggregate(db$counter,                  by=list(format(db$time, "%y-%m-%d %h")),                  sum)  names(res) <- c("date","count") res 

hth


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -