na.omit.ts {ts} | R Documentation

## NA Handling Routines for Time Series

### Description

For `na.omit.ts`, initial and final segments with missing values in one or more of the series are omitted. `Internal' missing values will lead to failure.

For `na.contiguous` the longest consecutive stretch of non-missing values is used. (In the event of a tie, the first such stretch.)

### Usage

    na.contiguous(frame)
    na.omit.ts(frame)

### Arguments

`frame` | a univariate or multivariate time series.

### Value

A time series without missing values. The class of `frame` will be preserved.

### Author(s)

B. D. Ripley

### See Also

`na.omit`, `na.fail`

### Examples

    data(BJsales)
    sales1 <- ts.union(BJsales, lead3 = lag(BJsales.lead, -3))
    na.omit.ts(sales1)

    data(presidents)
    na.contiguous(presidents)