i have a time series dataset containing 10000 rows with 1 year of data which looks like this
2012-01-01 06:23:02 c d10
2012-01-01 08:12:12 d d2
...........................
2012-12-31 08:22:24 s d5
it has 3 fields
date_time, category1, category2 where category1 contains 4 categorical values (c,v,d,s) category2 contains 10 categorical values(d1....d10).
i want to calculate the individual count of all the categorical values c,v,d,s with respect each categorical values d1......d10. it should be like how many c,v,d,s present for d1,d2....d10 with respect to the time frame 0-1, 1-2, .... 22-23
how to represent the above data in a time series starting from 1-2
, 2-3
, 3-4
,.....23-24
sample output should be like this
1-2 2-3 3-4 ........23-24
d1 c=2,d=3,v=3
s=4
d2 c=3 d=3,v=2,s=2
..................
d10
i have tried using lubridate,data.table packages but couldn't find out the expected solution