Learn R Programming

imputeTS (version 1.5)

na.remove: Remove Missing Values

Description

Removes all missing values from a time series.

Usage

na.remove(x)

Arguments

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

Value

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

Details

Removes all missing values from a time series. This shortens the time series by the number of missing values in the series. Should be handled with care, because this can affect the seasonality of the time series. Seasonal patterns might be destroyed and/or frequency parameter of the ts object might be no more correct.

See Also

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

Examples

Run this code
#Example 1: Remove all NAs
#Create Time series with missing values
x <- ts(c(2,3,NA,5,6,NA,7,8))
#Remove all NAs
na.remove(x)


#Example 2: Remove all NAs in tsAirgap
na.remove(tsAirgap)

Run the code above in your browser using DataLab