0
votes

I have looked at many of the questions on here that relate to aggregating time series data, but I can't seem to solve my problem. My data looks like this:

                    Pings Adult Entertainment Female Information Lifestyle Male MAV.TV MeTV News Pursuit Sports Young Adult
2015-01-05 07:30:00     1     0             0      0           0         0    0      0    0    0       0      0           0
2015-01-05 07:43:00     1     0             0      0           0         0    0      0    0    0       0      0           0
2015-01-05 07:44:00     1     0             0      0           0         0    0      0    0    0       0      0           0
2015-01-05 07:59:00     5     0             0      0           0         0    0      0    0    0       0      0           0
2015-01-05 08:02:00     1     0             0      0           0         0    0      0    0    0       0      0           0
2015-01-05 08:17:00     1     0             0      0           0         0    0      0    0    0       0      0           0

and I want to find a way to roll this up in 15 minute increments, summing every row. I've tried merge and cut and aggregate and na.locf methods, but none of them quite work. I've also tried period.apply but I can't seem to get that to work.

1
The cut.POSIXt function has the option of specifying an interval along the lines of breaks="15 min". Seems like using that approach would be close to trivial if used in combination with aggregate.IRTFM
Yes I just figured it out, thanks BondedDustModerat

1 Answers

0
votes

For timebreak = ISOdatetime(2015, 1, 5, 7, 0, 0) + (seq(0,7)*15*60), I used fac = cut(time(data), breaks = timebreak) and then aggregate(data, by = fac, FUN = sum)