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; the time_unit() returns the value of
time units.
Usage
pull_interval(x)
time_unit(x)
Arguments
x
A vector of POSIXt, Date, yearmonth, yearquarter, difftime,
hms, integer, numeric.
Value
pull_interval(): an "interval" class (a list) includes "year",
"quarter", "month", #' "week", "day", "hour", "minute", "second", "unit", and
other self-defined interval.
Details
The pull_interval() and time_unit() make a tsibble extensible to
support custom time index.
# NOT RUN {x <- seq(as.Date("2017-10-01"), as.Date("2017-10-31"), by = 3)
pull_interval(x)
# at two months interval ----x <- yearmonth(seq(2016, 2018, by = 0.5))
time_unit(x)
# }