impute_mean_window: Remove NA using weighted moving average

View source: R/sits_imputation.R

impute_mean_windowR Documentation

Remove NA using weighted moving average

Description

Remove NA using weighted moving average

Usage

impute_mean_window(data = NULL, k = 2, weighting = "simple")

Arguments

data

A time series vector or matrix

k

A integer width of the moving average window. Expands to both sides of the center element e.g. k = 2 means 4 observations (2 left, 2 right) are taken into account. If all observations in the current window are NA, the window size is automatically increased until there are at least 2 non-NA values present

weighting

A string with the weighting strategy to be used. More details below (default is "simple").

Value

A set of filtered time series using the imputation function.

Note

The weighting parameter defines the weighting strategy used in the moving window. The strategies available are:

  • simple - Simple Moving Average (SMA) (default option)

  • linear - Linear Weighted Moving Average (LWMA)

  • exponential - Exponential Weighted Moving Average (EWMA)

Author(s)

Felipe Carlos, efelipecarlos@gmail.com

References

The implementation of this function was adapted from the imputeTS R Package. The code is open-source, under the GPL license, and is available on GitHub https://github.com/SteffenMoritz/imputeTS.


sits documentation built on Jan. 14, 2026, 5:06 p.m.