R: Pull time interval from a vector

interval_pull {tsibble} | R Documentation

## Pull time interval from a vector

### Description

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

### Usage

    interval_pull(x)

### Arguments

`x` | A vector of `POSIXct`, `Date`, `yearweek`, `yearmonth`, `yearquarter`, `difftime`/`hms`, `ordered`, `integer`, `numeric`, and `nanotime`.

### Details

Extend tsibble to support custom time indexes by defining S3 generics `index_valid()` and `interval_pull()` for them.

### 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)
    interval_pull(x)

[Package tsibble version 0.8.2 Index]