This function calculates the moving average of a time series.
Author
Marina Papadopoulou m.papadopoulou.rug@gmail.com
Examples
bs <- rnorm(20, mean = 10, sd = 1)
moving_average(bs, 5)
#> [1] NA NA 10.306572 10.393398 10.427592 10.509909 10.545439
#> [8] 10.413849 10.421362 10.232866 10.164247 9.935881 9.962680 9.637138
#> [15] 9.492945 9.878210 9.865523 NA NA NA