Learn R Programming

RtsEva (version 1.1.0)

tsEvaFillSeries: Fill missing values in a time series using a moving average approach.

Description

This function takes a vector of timestamps and a corresponding series with missing values, and fills the missing values by taking the average of the surrounding values.

Usage

tsEvaFillSeries(timeStamps, series)

Value

A vector with missing values filled using a moving average approach.

Arguments

timeStamps

A vector of timestamps.

series

A vector representing the time series with missing values.

Examples

Run this code
timeStamps <- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
series <- c(1, 2, NA, 4, 5, NA, 7, 8, NA, 10)
filledSeries <- tsEvaFillSeries(timeStamps, series)
filledSeries

Run the code above in your browser using DataLab