Home > Blockchain >  R geom_forecast object not found
R geom_forecast object not found

Time:06-29

I want to create a forecasting plot via ggplot2. So, I have been trying to follow this enter image description here

Method 2:

# Using fortify.ts
p = ggplot(aes(x = year, y = AvgTMean), data = AvgTMaxYear)
p = p   geom_line()
p   geom_forecast()

Error:

Error in FUN(X[[i]], ...) : object 'AvgTMean' not found

CodePudding user response:

When I run your second method it runs like this:

library(ggplot2)
library(forecast)
p = ggplot(aes(x = year, y = AvgTMean), data = AvgTMaxYear)
p = p   geom_line()
p   geom_forecast()

Output:

enter image description here

  • Related