Add many time series features to the data
Source:R/augment-tk_augment_timeseries.R
tk_augment_timeseries.Rd
Add many time series features to the data
Arguments
- .data
A time-based tibble or time-series object.
- .date_var
For
tibbles
, a column containing either date or date-time values. IfNULL
, the time-based column will interpret from the object (tibble, xts, zoo, etc).
Details
tk_augment_timeseries_signature()
adds 25+ time series features including:
Trend in Seconds Granularity: index.num
Yearly Seasonality: Year, Month, Quarter
Weekly Seasonality: Week of Month, Day of Month, Day of Week, and more
Daily Seasonality: Hour, Minute, Second
Weekly Cyclic Patterns: 2 weeks, 3 weeks, 4 weeks
See also
Augment Operations:
tk_augment_timeseries_signature()
- Group-wise augmentation of timestamp featurestk_augment_holiday_signature()
- Group-wise augmentation of holiday featurestk_augment_slidify()
- Group-wise augmentation of rolling functionstk_augment_lags()
- Group-wise augmentation of lagged datatk_augment_differences()
- Group-wise augmentation of differenced datatk_augment_fourier()
- Group-wise augmentation of fourier series
Underlying Function:
tk_get_timeseries_signature()
- Returns timeseries features from an index
Examples
library(dplyr)
m4_daily %>%
group_by(id) %>%
tk_augment_timeseries_signature(date)
#> # A tibble: 9,743 × 31
#> # Groups: id [4]
#> id date value index.num diff year year.iso half quarter month
#> <fct> <date> <dbl> <dbl> <dbl> <int> <int> <int> <int> <int>
#> 1 D10 2014-07-03 2076. 1404345600 NA 2014 2014 2 3 7
#> 2 D10 2014-07-04 2073. 1404432000 86400 2014 2014 2 3 7
#> 3 D10 2014-07-05 2049. 1404518400 86400 2014 2014 2 3 7
#> 4 D10 2014-07-06 2049. 1404604800 86400 2014 2014 2 3 7
#> 5 D10 2014-07-07 2006. 1404691200 86400 2014 2014 2 3 7
#> 6 D10 2014-07-08 2018. 1404777600 86400 2014 2014 2 3 7
#> 7 D10 2014-07-09 2019. 1404864000 86400 2014 2014 2 3 7
#> 8 D10 2014-07-10 2007. 1404950400 86400 2014 2014 2 3 7
#> 9 D10 2014-07-11 2010 1405036800 86400 2014 2014 2 3 7
#> 10 D10 2014-07-12 2002. 1405123200 86400 2014 2014 2 3 7
#> # ℹ 9,733 more rows
#> # ℹ 21 more variables: month.xts <int>, month.lbl <ord>, day <int>, hour <int>,
#> # minute <int>, second <int>, hour12 <int>, am.pm <int>, wday <int>,
#> # wday.xts <int>, wday.lbl <ord>, mday <int>, qday <int>, yday <int>,
#> # mweek <int>, week <int>, week.iso <int>, week2 <int>, week3 <int>,
#> # week4 <int>, mday7 <int>