Relative Content

Tag Archive for rtime-seriesmeanrolling-computation

Mean for rolling window of 5 minutes

I have a data frame table 1 with close to 56 million rows which captures the comment made on different videos.. The columns are videoID (an identifier for video),Time (captures the time to nearest minute),Time_5 (captures 5 minutes before the time) and emotion (captures the emotional score of comment). I want the mean score of emotions for last 5 minutes such that data$Time >= Time_5 & data$Time < Time. It’s like a rolling window that I am trying to cover and get Table-2. I used the code that I could find on other stack overflow questions but they are quite slow since I have 56 million rows.