1 Reply Latest reply on Feb 9, 2017 4:16 PM by Santiago Sanchez

    Error in forecast()

    Ina Alban

      Hello,

      I keep on getting this error whenever I run my forecast function

       

      Error in base::parse(text = .cmd) : <text>:6:0: unexpected end of input 4: n <- length(.arg1[1]); 5: append(.arg1[(.arg2[1]+1):n],fcast$mean, after = n-.arg2[1] ^

       

       

      Here is my code that generates this error:

      SCRIPT_REAL("library(forecast);

      time <- ts(.arg1, start = c(2010,1), frequency=12);

      fcast <- forecast(time, h= .arg2[1]);

      n <- length(.arg1[1]);

      append(.arg1[(.arg2[1]+1):n],fcast$mean, after = n-.arg2[1]",

      SUM([Sales]), [Periods to Forecast])

       

      Hope someone can help me fix this error. Thanks!

        • 1. Re: Error in forecast()
          Santiago Sanchez

          Hi Ina,

           

          Looks like a couple of syntax errors (line 4 and 5). Try this:

           

          SCRIPT_REAL("library(forecast);

          time <- ts(.arg1, start = c(2010,1), frequency=12);

          fcast <- forecast(time, h= .arg2[1]);

          n <- length(.arg1);

          append(.arg1[(.arg2[1]+1):n],fcast$mean, after = n-.arg2[1])",

          SUM([Sales]), [Periods to Forecast])

           

          Hope this helps!