Learn R Programming

tsbox (version 0.3.1)

ts_na_omit: Omit NA values

Description

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

Usage

ts_na_omit(x)

Value

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

Arguments

x

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

Details

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

See Also

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

Examples

Run this code
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))))

Run the code above in your browser using DataLab