mavc: Centered Moving Avarage

View source: R/mavc.R

mavcR Documentation

Centered Moving Avarage

Description

mavc calculates the k-period centered moving avarage of a vector or time series. When k is even the series length is increased by one and the two endpoints are weighted by 0.5.

Usage

mavc(x, k)

Arguments

x

Numeric vector or a time series.

k

Integer, window length.

Value

A numeric vector.

Examples

coreinf_br %>%
dplyr::select(-date) %>%
purrr::map_df(~mavc(.x, 25)) %>%
tibble::add_column(date = coreinf_br$date, .before = 1)

nelson16silva/wavcoreinf documentation built on Feb. 17, 2025, 7:10 p.m.