seasthedata: Easily seasonally adjust a tibble or data.frame of long data

Description Usage Arguments Details Examples

View source: R/seasthedata.R

Description

seasthedata will automatically seasonally adjust every column in your tibble while respecting groups. Your data must contain exactly one column of dates.

Usage

1
seasthedata(original, frequency = NULL, use_original = FALSE, ...)

Arguments

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)

Details

seasthedata is a wrapper around the seasonal library (https://github.com/christophsax/seasonal)

Examples

 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)

angusmoore/seasthedata documentation built on Sept. 26, 2021, 12:08 p.m.