R/serviceFunctions.R

Defines functions ma

ma <- function(x, n = 5, sides = 2){
  # moving average for a vector with the convolution method
  res <- stats::filter(x, rep(1 / n, n), 
                       method = "convolution", sides = sides)
  as.numeric(res)
  }
OnofriAndreaPG/aomisc documentation built on Feb. 26, 2024, 8:21 p.m.