n <- 15
x <- rnorm(n)
weights <- 0.9 ^ (n:1)
# rolling standard deviations with complete windows
roll_sd(x, width = 5)
# rolling standard deviations with partial windows
roll_sd(x, width = 5, min_obs = 1)
# expanding standard deviations with partial windows
roll_sd(x, width = n, min_obs = 1)
# expanding standard deviations with partial windows and weights
roll_sd(x, width = n, min_obs = 1, weights = weights)
Run the code above in your browser using DataLab