tk_get_timeseries | R Documentation |
Get date features from a time-series index
tk_get_timeseries_signature(idx)
tk_get_timeseries_summary(idx)
idx |
A time-series index that is a vector of dates or datetimes. |
tk_get_timeseries_signature
decomposes the timeseries into commonly
needed features such as
numeric value, differences,
year, month, day, day of week, day of month,
day of year, hour, minute, second.
tk_get_timeseries_summary
returns the summary returns the
start, end, units, scale, and a "summary" of the timeseries differences
in seconds including
the minimum, 1st quartile, median, mean, 3rd quartile, and maximum frequency.
The timeseries
differences give the user a better picture of the index frequency
so the user can understand the level of regularity or irregularity.
A perfectly regular time series will have equal values in seconds for each metric.
However, this is not often the case.
Important Note: These functions only work with time-based indexes in datetime, date, yearmon, and yearqtr values. Regularized dates cannot be decomposed.
Returns a tibble
object describing the timeseries.
tk_index()
, tk_augment_timeseries_signature()
, tk_make_future_timeseries()
library(dplyr)
library(lubridate)
library(zoo)
# Works with time-based tibbles
FB_tbl <- FANG %>% dplyr::filter(symbol == "FB")
FB_idx <- tk_index(FB_tbl)
tk_get_timeseries_signature(FB_idx)
tk_get_timeseries_summary(FB_idx)
# Works with dates in any periodicity
idx_weekly <- seq.Date(from = lubridate::ymd("2016-01-01"), by = 'week', length.out = 6)
tk_get_timeseries_signature(idx_weekly)
tk_get_timeseries_summary(idx_weekly)
# Works with zoo yearmon and yearqtr classes
idx_yearmon <- seq.Date(from = lubridate::ymd("2016-01-01"),
by = "month",
length.out = 12) %>%
zoo::as.yearmon()
tk_get_timeseries_signature(idx_yearmon)
tk_get_timeseries_summary(idx_yearmon)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.