title: In R, a rolling Standard Deviation that can skip over NA values?
body: <p>I am wondering if there are any fast R functions that can compute a rolling Standard Deviation on a vector, while skipping over any NA values in the middle of said vector, so the vector still lines up with the original data?</p>
  
  <p>The package <code>TTR</code> has <code>runSD</code> but it returns an error if there is NA in the middle of the vector.</p>
  
  <p>The package <code>fTrading</code> has <code>rollVar</code> which has <code>na.rm=TRUE</code>. Taking the square root of the rolling variance gives the standard deviation. However, it actually deletes the NA values, which means that the rolling standard deviation no longer lines up with the original data.</p>
  
  <p>Or, is there a way to temporarily remove the NA values, then insert them back when the calculation is done?</p>
  
  <p><strong>Update</strong></p>
  
  <p>See <a href="https://stackoverflow.com/questions/3908831/re-inserting-nas-into-a-vector">Re-inserting NAs into a vector</a>.</p>