how to show this plot with these data in R? any helpful code?
0
votes
1 Answers
0
votes
library(forecast)
#> Registered S3 method overwritten by 'quantmod':
#> method from
#> as.zoo.data.frame zoo
decomp <- stl(gas, 5)
plot(decomp)
print(head(decomp$time.series))
#> seasonal trend remainder
#> Jan 1956 -330.9170 2015.744 24.173111
#> Feb 1956 -402.1667 2020.906 27.261128
#> Mar 1956 -238.4648 2026.067 6.397573
#> Apr 1956 -151.6784 2031.229 -1.550535
#> May 1956 170.7040 2036.306 -34.010462
#> Jun 1956 275.1713 2041.384 4.444837
Created on 2022-03-02 by the reprex package (v2.0.1)