Description Usage Arguments Details Examples
seasthedata will automatically seasonally adjust every column in your tibble while respecting groups. Your data must contain exactly one column of dates.
1 | seasthedata(original, frequency = NULL, use_original = FALSE, ...)
|
original |
Your data, in original terms, to be seasonally adjusted. |
frequency |
(Optional) The frequency of your data. Accepted options are "quarter", "month", "day". If omitted, seasthedata will guess the frequency. |
use_original |
(default: FALSE) If the series cannot be seasonally adjusted, should the returned data have NAs for the relevant series (default) or the original data. |
... |
Options to be passed to X13. See the documentation for the seas function (https://cran.r-project.org/web/packages/seasonal/seasonal.pdf) |
seasthedata is a wrapper around the seasonal library (https://github.com/christophsax/seasonal)
1 2 3 4 5 6 7 8 9 10 11 | library(dplyr)
library(tibble)
ungrouped_data <- tibble(dates = seq.Date(from = as.Date("1949-01-01"),
by = "month", length.out = 144),
y = as.vector(AirPassengers))
seasthedata(ungrouped_data)
grouped_data <- bind_rows(mutate(ungrouped_data, group = "A"),
mutate(ungrouped_data, group = "B"))
grouped_data <- group_by(grouped_data, group)
seasthedata(grouped_data)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.