| decompose_ts | R Documentation |
Decomposes a time series into trend, seasonal, and residual components using simple moving averages and group means. The function returns the residual component (or the original series with trend removed) to simplify analysis.
decompose_ts(data, cols = NULL, date_col = NULL,
period = "month", method = "additive", verbose = FALSE)
data |
A data frame with a time column. |
cols |
Column indices or names to decompose. |
date_col |
Time column index or name. |
period |
Seasonal period: |
method |
Decomposition method: |
verbose |
Logical; if |
A data frame with the residual component.
decompose_ts(data[1:500, c(1, 4, 17:19)], cols = 3:5, date_col = 1, period = "month")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.