runMean: Calculate a running mean from a numeric vector.

Description Usage Arguments Value Examples

View source: R/utilities.R

Description

Calculate a running mean from a numeric vector.

Usage

1
runMean(x, n, edge = "NA")

Arguments

x

numeric vector to smooth.

n

the size of the window in which to smooth.

edge

How to treat edge cases where a full window is unavailable. Current options are 'NA' to fill with NAs or 'fill' to fill with original values

Value

A numeric vector of smoothed values.

Examples

1
2
3
4
x <- rnorm(1000)
y <- c(1:1000)
plot(y,x, type="l")
lines(runMean(x,50), col="red")

Example output



rcarbon documentation built on Jan. 13, 2021, 7:09 p.m.