Learn R Programming

swaRmverse (version 0.1.0)

moving_average: Moving Average

Description

This function calculates the moving average of a time series.

Usage

moving_average(timeseries, window)

Value

A vector of doubles (average over the window).

Arguments

timeseries

Vector of doubles representing a timeseries.

window

Double, the time-window to average over (in timesteps).

Author

Marina Papadopoulou m.papadopoulou.rug@gmail.com

Examples

Run this code
bs <- rnorm(20, mean = 10, sd = 1)
moving_average(bs, 5)

Run the code above in your browser using DataLab