How to make a set containing count of data in rolling set of buckets
r, xts
Solution
To expand on @PLapointe's answer:
endp <- endpoints(tab2, on="mins", k=1) # 1 minute endpoints
onemin <- period.apply(tab2,endp,sum) # sum per 1-minute period
onemin <- align.time(onemin) # align to end-of-period times
# all one-minute increments from start--end of onemin
allonemin <- seq(start(onemin), end(onemin), by="1 min")
onemin <- merge(onemin, xts(,allonemin))
fivemin <- rollapplyr(onemin, 5, sum, na.rm=TRUE, fill=NA)
Problem
I have the server logs for a months worth of traffic. Partial example below ``` "UploadDateGMT","UserFileSize","TotalBusinessUnits" "2012-01-01 00:00:38","1223","1" "2012-01-01 00:01:16","1302","1" "2012-01-01 00:08:10","1302","1" ``` I would like to convert this into a data set where I have a count of how many bytes of submissions there were in each five minute window on a rolling basis. (i.e. 0-5, 1-6, 2-7, etc.) From this, I could extract maximum load, 95% load, make pretty graphs of load, etc.