ma: Seven-Day Moving Average

View source: R/helpers.R

maR Documentation

Seven-Day Moving Average

Description

This function returns a (by default) seven-day moving average of the variable passed in. Make sure the data is pre-sorted by date, and grouped by the appropriate grouping. The data should have no gaps in time.

Usage

ma(x, n = 7)

Arguments

x

The variable to calculate the moving average of.

n

The number of lags to cover in the moving average.

Examples


ma(1:9)


SafeGraphInc/SafeGraphR documentation built on Nov. 25, 2022, 11:20 a.m.