Learn R Programming

tsibble (version 0.5.3)

pull_interval: Extract 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, integer, numeric.

Value

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

Details

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

Examples

Run this code
# NOT RUN {
x <- seq(as.Date("2017-10-01"), as.Date("2017-10-31"), by = 3)
pull_interval(x)
# }

Run the code above in your browser using DataLab