R: Pull time interval from a vector

pull_interval {tsibble} | R Documentation

## Pull time interval from a vector

### Description

Assuming regularly spaced time, the `pull_interval()` returns a list of time components as the "interval" class.

### Usage

    pull_interval(x)

### Arguments

`x` | A vector of `POSIXt`, `Date`, `yearmonth`, `yearquarter`, `difftime`, `hms`, `ordered`, `integer`, `numeric`.

### Details

`index_valid()` and `pull_interval()` make a tsibble extensible to support custom time index.

### Value

an "interval" class (a list) includes "year", "quarter", "month", "week", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "unit".

### Examples

    x <- seq(as.Date("2017-10-01"), as.Date("2017-10-31"), by = 3)
    pull_interval(x)

[Package tsibble version 0.7.0 Index]