I am trying to run a piece of code following strict instructions from https://otexts.com/fpp3/graphics-exercises.html
I am using the following packages
library(tsibble)
library(tidyverse)
library(tsibbledata)
library(fable)
library(fpp3)
library(forecast)
library(ggplot2)
library(ggfortify)
I ran the following lines of code in order to get a timeseries object (aus_retail)
set.seed(12345678)
myseries <- aus_retail %>%
filter(`Series ID` == sample(aus_retail$`Series ID`,1))
As an exercise, the author suggests in the page above: "Explore your chosen retail time series using the following functions:"
autoplot(), ggseasonplot(), ggsubseriesplot(), gglagplot(), ggAcf()
So, i tried to run the following line of code
forecast::ggseasonplot(x = myseries)
Which answered me the following error:
Error in forecast::ggseasonplot(x = myseries$Turnover) :
autoplot.seasonplot requires a ts object, use x=object
Reading the function help, there is a Example with the AirPassengers dataset (base), which is not even a ts object
Examples
ggseasonplot(AirPassengers, year.labels=TRUE, continuous=TRUE)
which runs as below
The code runs without the others parameters too
ggseasonplot(AirPassengers)
Why the function keeps asking me for a ts object even though i input one to it?