library(dplyr)
library(forecast)
library(sweep)
# Decompose ETS model
USAccDeaths %>%
ets() %>%
sw_tidy_decomp()
# Decompose STL object
USAccDeaths %>%
stl(s.window = 'periodic') %>%
sw_tidy_decomp()
Run the code above in your browser using DataLab