Learn R Programming

imputeTS (version 3.3)

na.mean: Deprecated use na_mean instead.

Description

na.mean is replaced by na_mean. The functionality stays the same. The new name better fits modern R code style guidelines (which prefer _ over . in function names).

Usage

na.mean(x, option = "mean", maxgap = Inf, ...)

Arguments

x

Numeric Vector (vector) or Time Series (ts) object in which missing values shall be replaced

option

Algorithm to be used. Accepts the following input:

  • "mean" - take the mean for imputation (default choice)

  • "median" - take the median for imputation

  • "mode" - take the mode for imputation

  • "harmonic" - take the harmonic mean

  • "geometric" - take the geometric mean

maxgap

Maximum number of successive NAs to still perform imputation on. Default setting is to replace all NAs without restrictions. With this option set, consecutive NAs runs, that are longer than 'maxgap' will be left NA. This option mostly makes sense if you want to treat long runs of NA afterwards separately.