title: How to calculate rolling average of past 1 month in R
body: <p>Most packages and posts I found apply mean to a fixed size window or the aggregate month/week data. Is it possible to calculate rolling k month average?</p>
  
  <p>For example, for <strong>1 month rolling window</strong>, assuming the data is:</p>
  
  <pre><code>Date          Value
  2012-05-28    101
  2012-05-25     99
  2012-05-24    102
  ....
  2012-04-30     78
  2012-04-27     82
  2012-04-26     77
  2012-04-25     75
  2012-04-24     76
  </code></pre>
  
  <p>The first three rolling 1 month windows should be:</p>
  
  <pre><code>1. 2012-05-28 to 2012-04-30
  2. 2012-05-25 to 2012-04-26
  3. 2012-05-24 to 2012-04-25
  </code></pre>
  
  <p>Please note that this is NOT the fixed width rolling window. The window actually changes on the daily basis.</p>