how about ... j=NULL for(i in 4: length(xyz$Close)) { j[i] = sd(xyz$Close[i-3:i]) } print(j) -- View this message in context: http://r.789695.n4.nabble.com/How-to-do-a-moving-window-on-standard-deviation-tp3247566p3247634.html Sent from the R help mailing list archive at Nabble.com.