title: Rollapply for time series
body: <p>I am trying to calculate the rolling 20 period historical volatility. I take the daily returns:</p>
  <pre><code>ret &lt;- ROC(data1)
  </code></pre>
  <p>And then I use rollapply to get the 20 day HV for each column:</p>
  <pre><code>vol &lt;- rollapply(ret, 20, sd, by.column=T, fill=NA)
  </code></pre>
  <p>The problem is that observations in vol starts appearing after ten days which is wrong as I specified 20.</p>
  <p>For demonstration here is sample of the data:</p>
  <pre><code>0.000000000, 0.005277045, 0.023622047, 0.002564103,-0.002557545, -0.020512821,
  0.007853403,-0.012987013,  0.007894737,  0.015665796,  0.000000000, -0.002570694,
  0.002577320, -0.015424165, 0.002610966,  0.010416667,  0.002577320,  0.015424165, 
  0.000000000, -0.002531646, -0.002538071, 0.030534351,  0.014814815, -0.007299270,
  -0.009803922, -0.012376238,  0.002506266, -0.015000000,-0.002538071,  0.002544529
  </code></pre>
  <p>Assume the data above is stored in x, then:</p>
  <pre><code>rollapply(x, 20, sd, fill=NA)
  </code></pre>
  <p>will yield a first observation at 10th row instead of 20. Also the sd is wrong too.</p>
  <p>I should be missing something here...</p>