?traceback ?debug ?trace R has built-in debugging tools. Learn to use them.
Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Mon, Sep 5, 2016 at 11:25 AM, Erika Rocío Espinosa Balbuena <erika...@gmail.com> wrote: > Hi, > > I am working with this code: > > forecast_nal<-data.frame() > out<-vector() > x<-foreach(i=1:nrow(comb)) %do% > { > > s<-comb[i,'prod_id'] > > #Familia+Sumbarca+prod_id > #Serie > > bcomb1<-b > bcomb1<-subset(bcomb1,bcomb1$prod_id == s & bcomb1$year <= 2015) > bcomb1<-arrange(bcomb1,year,week) > a<-bcomb1[1:1,'week'] > d<-bcomb1[1:1,'year'] > f<-nrow(bcomb1) > h<-bcomb1[f:f,'year'] > j<-bcomb1[f:f,'week'] > bcomb1<-bcomb1[,c(6)] > > if (length(bcomb1)<=10 || h=="2014" || (h=="2015" && j<=48)) > { > out[i]<-s > } > else > { > y <- ts(bcomb1, frequency=52, start=c(d, a)) > ##Casos > > if (length(y)<=60) > { > > v<-auto.arima(y) > v<-arimaorder(v) > fit <- arima(y, order = v ,method="ML") > fca <- forecast(fit, h = 16) > dates <- attr(forecast_nal$mean, "tsp") > datecol <- seq(from=dates[1], to=dates[2], by=1/dates[3]) > fct<-cbind.data.frame(s,datecol,Point=fca$mean) > forecast_nal<- rbind.data.frame(forecast_nal,fct) > } > else > { > > fit <- tbats(y) > fcb <- forecast(fit, h = 16) > dates <- attr(forecast_nal$mean, "tsp") > datecol <- seq(from=dates[1], to=dates[2], by=1/dates[3]) > fct<-cbind.data.frame(s,datecol,Point=fcb$mean) > forecast_nal<- rbind.data.frame(forecast_nal,fct) > } > } > } > But I am getting this error: > > Error in `[<-.ts`(`*tmp*`, ri, value = c(26656.136365833, 26750.9374514082, > : > only replacement of elements is allowed > > Can someone help me with this? > > Thanks > > > -- > Erika Rocío Espinosa Balbuena > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.