title: Calculate cumulative standard deviation
body: <p>I'm trying to calculate the standard deviation of values in a time series, but I'd like to do it incrementally by advancing one day from the initial date value each time. I know there is a way to do this in R (probably using ddply?) that doesn't involve a nasty for-loop. Thanks for any help!</p>
  
  <pre><code>d&lt;-seq(from=as.Date("2013-01-01"), to=as.Date("2013-02-01"), by="day")
  v &lt;-rnorm(32, 10, 5)
  test.df&lt;-data.frame(the_date=d, value=v)
  </code></pre>
  
  <p>Here's the way I'm doing it now. </p>
  
  <pre><code>result &lt;- c()
  for(i in 2:nrow(test.df)){ result[i-1] &lt;- sd(test.df[1:i,]$value)}
  </code></pre>