runn_mean: Running mean of a vector

View source: R/runn_mean.R

runn_meanR Documentation

Running mean of a vector

Description

Function to calculate the running mean of a numeric vector

Usage

runn_mean(
  vec,
  runn_mean,
  na.rm = FALSE,
  exclude_central_value = FALSE,
  FUN = mean
)

Arguments

vec

numeric vector

runn_mean

number of vector elements to use for calculating the running mean

na.rm

ignore NA values when calculating means. Defaults to FALSE.

exclude_central_value

exclude central value in calculating means. Defaults to FALSE.

FUN

function to be applied. For a running mean, this is usually mean (the default), but other functions can also be specified here (the na.rm parameter won't work then, and the function has to be dependent on one numeric variable only.

Value

numeric vector containing the running mean

Author(s)

Eike Luedeling

Examples



plot(runn_mean(rnorm(1000),150))


chillR documentation built on Nov. 28, 2023, 1:09 a.m.