rmean function

Calculate a rolling mean for a vector x.

Calculate a rolling mean for a vector x.

rmean(x, width = 11)

Arguments

  • x: Numeric vector for which to calculate the rolling mean.
  • width: Width of the interval over which to calculate rolling mean values. Should be an uneven number (even numbers are coerced into the next-higher uneven number)

Returns

A numeric vector of the same length as x containing the calculated rolling means, with the first and last few values being NA (depending on the setting for width)

Examples

rmean(x=c(1,2,3,4,5,6),width=5)
  • Maintainer: Darius Nau
  • License: GPL (>= 3)
  • Last published: 2025-03-23

Useful links