When I'm trying to generate the algorithm I get this error:
Error in UseMethod("forecast") :
no applicable method for 'forecast' applied to an object of class "forecast"
Referred here by Forecasting: Principles and Practice, by Rob J Hyndman and George Athanasopoulos