Learn R Programming

ldhmm (version 0.6.1)

ldhmm.sma: Simple moving average of a time series

Description

This utility calculates simple moving average, with option to backfill for NA.

Usage

ldhmm.sma(x, order, na.backfill = TRUE)

Value

numeric, simple moving average, same length as x.

Arguments

x

numeric, the time series.

order

a positive integer to specify order of moving average.

na.backfill

logical, specify whether to backfill for NA. Default is TRUE.

Author

Stephen H. Lihn

Examples

Run this code
x <- 1:100
a <- ldhmm.sma(x, 10)

Run the code above in your browser using DataLab