A possible solution with data.table (which you are apperently using):
dt[dcast(dt, hour ~ hour, value.var = 'hour', fun = length), on = .(hour)]
which gives:
time hour Money day 1 2 3 4 5 6
1: 20000616 1 9.35 5 1 0 0 0 0 0
2: 20000616 2 6.22 5 0 1 0 0 0 0
3: 20000616 3 10.65 5 0 0 1 0 0 0
4: 20000616 4 11.42 5 0 0 0 1 0 0
5: 20000616 5 10.12 5 0 0 0 0 1 0
6: 20000616 6 7.32 5 0 0 0 0 0 1
I suppose that in your real dataset you will have more variation in time's and day's, you can then adapt the code to:
dt[dcast(dt, time + day + hour ~ hour, value.var = 'hour', fun = length)
, on = .(time, day, hour)]
Used data:
dt <- fread(' time hour Money day
20000616 1 9.35 5
20000616 2 6.22 5
20000616 3 10.65 5
20000616 4 11.42 5
20000616 5 10.12 5
20000616 6 7.32 5')