View source: R/augment-tk_augment_fourier.R
tk_augment_fourier | R Documentation |
A handy function for adding multiple fourier series to a data frame.
Works with dplyr
groups too.
tk_augment_fourier(.data, .date_var, .periods, .K = 1, .names = "auto")
.data |
A tibble. |
.date_var |
A date or date-time column used to calculate a fourier series |
.periods |
One or more periods for the fourier series |
.K |
The maximum number of fourier orders. |
.names |
A vector of names for the new columns. Must be of same length as the number of output columns. Use "auto" to automatically rename the columns. |
Benefits
This is a scalable function that is:
Designed to work with grouped data using dplyr::group_by()
Add multiple differences by adding a sequence of differences using
the .periods
argument (e.g. lags = 1:20
)
Returns a tibble
object describing the timeseries.
Augment Operations:
tk_augment_timeseries_signature()
- Group-wise augmentation of timestamp features
tk_augment_holiday_signature()
- Group-wise augmentation of holiday features
tk_augment_slidify()
- Group-wise augmentation of rolling functions
tk_augment_lags()
- Group-wise augmentation of lagged data
tk_augment_differences()
- Group-wise augmentation of differenced data
tk_augment_fourier()
- Group-wise augmentation of fourier series
Underlying Function:
fourier_vec()
- Underlying function that powers tk_augment_fourier()
library(dplyr)
m4_monthly %>%
group_by(id) %>%
tk_augment_fourier(date, .periods = c(6, 12), .K = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.