[R] Variable Length Differ

TJUN KIAT TEO teotjunk at hotmail.com
Sun Nov 2 12:19:45 CET 2014


This is my code

    BSUPred<-(forecast(BSU,h=h)[[2]])
    PressurePred<-(forecast(Pressure,h=h)[[2]])
    Placer<-(rep(1,h))
    test<-as.data.frame(cbind(BSUPred,PressurePred))
    test$Placer<-rep(1:2,h/12)
    test$Placer<-i
    test<-as.data.frame((test[c("Placer","BSUPred","PressurePred")]))
    resp<-predict(fit,newdata=test,type="response")
    Pred<-ifelse((predict(fit,newdata=test,type="response")>0.5),1,0)

But I get this error message

Error in model.frame.default(Terms, newdata, na.action = na.action, xlev = object$xlevels) : 
  variable lengths differ (found for 'Placer') 

Can anyone help?

Thanks

Tjun Kiat
 		 	   		  
	[[alternative HTML version deleted]]



More information about the R-help mailing list