season_adjust: Seasonally adjusted

Description Usage Arguments Value See Also Examples

View source: R/tq_sa.R

Description

Seasonally adjusted

Usage

1
season_adjust(x, order_by, ...)

Arguments

x

A numeric vector.

order_by

A date vector to order by.

...

Parameters in [seasonal::seas] function.

Value

A numeric vector of the same length as 'x'.

See Also

[seasonal::seas]

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
# example from base
season_adjust((0:107)^2, seq(as.Date("2001-01-01"), as.Date("2009-12-01"), "months"))
# Automatically order even if data not already ordered (example from dplyr)
library(dplyr, warn.conflicts = FALSE)
tsbl <- tsibble(month = seq(as.Date("2001-01-01"), as.Date("2009-12-01"), "months"),
 value = (0:107)^2, index = month)
scrambled <- tsbl %>% slice(sample(nrow(tsbl)))

right <- mutate(scrambled, sa = season_adjust(value, month))
arrange(right, month)

## End(Not run)

mitsuoxv/tqr documentation built on Nov. 14, 2021, 7:18 p.m.