title: Calculating rolling average over time by two conditions
body: <p>A (small example) of my data is structured as follows:</p>
  
  <pre><code>Individ &lt;- data.frame(Participant = c("Bill", "Bill", "Bill", "Bill", "Bill", "Bill", "Jane", "Jane", "Jane", "Jane", 
                                        "Jane", "Jane", "Jane", "Jane", "Jane", "Jane", "Jane", "Jane", "Bill", "Bill", "Bill", "Bill", "Bill", "Bill"),  
                        Time = c(1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6),
                        Condition = c("Placebo", "Placebo", "Placebo", "Placebo", "Placebo", "Placebo", "Expr", "Expr", "Expr", "Expr", "Expr", "Expr", 
                                      "Placebo", "Placebo", "Placebo", "Placebo", "Placebo", "Placebo", "Expr", "Expr", "Expr", "Expr", "Expr", "Expr"),
                        Location = c("Home", "Home", "Home", "Home", "Home", "Home", "Home", "Home", "Home", "Home", "Home", "Home", "Home", "Home", "Home", "Home", "Home", "Home", 
                                     "Away", "Away", "Away", "Away", "Away", "Away"),
                        Power = c(400, 250, 180, 500, 300, 450, 600, 512, 300, 500, 450, 200, 402, 210, 130, 520, 310, 451, 608, 582, 390, 570, 456, 205))
  </code></pre>
  
  <p>I wish to calculating a rolling three second average of <code>Power</code> over <code>Time</code> for each <code>Participant</code> at both <code>Condition</code> and <code>Location</code>.</p>
  
  <p>My research design is a repeated measures cross-over, evident that Jane has power recorded at Home under both treatment conditions (Placebo v Exper). My dataset is 4 million rows in length, how can I please quickly and easily calculate this moving average?</p>
  
  <p>This question: <a href="https://stackoverflow.com/questions/23619855/constructing-moving-average-over-a-categorical-variable-in-r">Constructing moving average over a categorical variable in R</a> is similar as is this: <a href="https://stackoverflow.com/questions/26198551/rolling-mean-moving-average-by-group-id-with-dplyr?rq=1">Rolling mean (moving average) by group/id with dplyr</a> but I am wanting to average over a three second period and more than one grouping variable.</p>