na_remove | R Documentation |
Removes all missing values from a time series.
na_remove(x)
x |
Numeric Vector ( |
Removes all missing values from a input 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. Independent from the input, this function only returns a vector. (the time information of a resulting time series object wouldn't be correct any more).
Vector (vector
)
Steffen Moritz
na_interpolation
,
na_kalman
, na_locf
,
na_ma
, na_mean
,
na_random
, na_replace
,
na_seadec
, na_seasplit
# Example 1: Remove all NAs # Create Time series with missing values x <- ts(c(2, 3, NA, 5, 6, NA, 7, 8)) # Example 1: Remove all NAs na_remove(x) # Example 2: Remove all NAs in tsAirgap na_remove(tsAirgap) # Example 3: Same as example 1, just written with pipe operator x %>% na_remove()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.