Error: [Time series] Invalid input: date_trans works with objects of class Date only

Hello,

I do not know what is the problem with my code. Can you please let me know what do I get the error message below??

Error: Invalid input: date_trans works with objects of class Date only

library(fma)
library(fpp)
library(ggfortify)
library(fpp2)
library(GGally)
library(forecast)

beer2 <- window(ausbeer,start=1992,end=c(2007,4))
beerfit1 <- meanf(beer2,h=10)
beerfit2 <- rwf(beer2,h=10)
beerfit3 <- snaive(beer2,h=10)
autoplot(window(ausbeer, start=1992)) +
autolayer(beerfit1, series="mean", PI=FALSE) +
autolayer(beerfit2, series="naive", PI=FALSE) +
autolayer(beerfit3, series="seasonal naive", PI=FALSE)

You are loading unnecessary packages, and ggfortify in particular does not play nicely with the other packages. All you need for this example is the fpp2 package.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.