na.interpolation

0th

Percentile

Missing Value Imputation by Interpolation

Uses either linear, spline or stineman interpolation to replace missing values.

Usage
na.interpolation(x, option = "linear", ...)
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:

  • "linear" - for linear interpolation using approx

  • "spline" - for spline interpolation using spline

  • "stine" - for Stineman interpolation using stinterp

...

Additional parameters to be passed through to approx or spline interpolation functions

Details

Missing values get replaced by values of a approx, spline or stinterp interpolation.

Value

Vector (vector) or Time Series (ts) object (dependent on given input at parameter x)

References

Johannesson, Tomas, et al. (2015). "Package stinepack".

See Also

na.kalman, na.locf, na.ma, na.mean, na.random, na.replace, na.seadec, na.seasplit

Aliases
  • na.interpolation
Examples
# NOT RUN {
#Prerequisite: Create Time series with missing values
x <- ts(c(2,3,4,5,6,NA,7,8))

#Example 1: Perform linear interpolation
na.interpolation(x)

#Example 2: Perform spline interpolation
na.interpolation(x, option = "spline")

#Example 3: Perform stine interpolation
na.interpolation(x, option = "stine")

#Example 4: Same as example 1, just written with pipe operator
x %>% na.interpolation

#Example 5: Same as example 2, just written with pipe operator
x %>% na.interpolation(option = "spline")

# }
Documentation reproduced from package imputeTS, version 2.7, License: GPL-3

Community examples

Looks like there are no examples yet.