ts_na_omit: Omit NA values

Description Usage Arguments Details Value See Also Examples

View source: R/ts_na_omit.R

Description

Remove NA values in ts-boxable objects, turning explicit into implicit missing values.

Usage

1

Arguments

x

ts-boxable time series, an object of class ts, xts, zoo, data.frame, data.table, tbl, tbl_ts, tbl_time, or timeSeries.

Details

Note that internal NAs in ts time series will not be removed, as this conflicts with the regular structure.

Value

a ts-boxable time series, with the same class as the input.

See Also

ts_regular, for the opposite, turning implicit into explicit missing values.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
x <- AirPassengers
x[c(2, 4)] <- NA

# A ts object does only know explicit NAs
head(ts_na_omit(x))

# by default, NAs are implicit in data frames
head(ts_df(x))

# make NAs explicit
head(ts_regular(ts_df(x)))

# and implicit again
head(ts_na_omit(ts_regular(ts_df(x))))

christophsax/tsbox documentation built on June 26, 2018, 1:13 p.m.