I want to create a forecasting plot via ggplot2
. So, I have been trying to follow this
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: