简体   繁体   中英

Aggregating Time Series data by 15 minutes

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.

对于timebreak = ISOdatetime(2015, 1, 5, 7, 0, 0) + (seq(0,7)*15*60) ,我使用fac = cut(time(data), breaks = timebreak)然后aggregate(data, by = fac, FUN = sum)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM