I worked on Tableau and R, I want to forecast school number yearly. I created two calculated field : dataforcast calculated field
DATE(IF [School Year] == { MAX([School Year]) }
THEN DATEADD('year', 1, [School Year]) ELSE [School Year] END)
School number forecast calculate field but it shows an error:
Error in numeric(h) : vector size cannot be NA/NaN
SCRIPT_REAL("library(forecast);
x <- .arg1;
y <- .arg2;
myts <- ts(.arg1,start=c(2008,1), frequency= 1);
myforecast <- forecast(myts, h=.arg1[1]);
monthsts<-length(.arg1);
append(.arg1[(.arg2[1]+1):monthsts], myforecast$mean, after= monthsts )",
SUM([Number of students]) , ATTR([Dateforcast]))