Error in model.frame.default(Terms, newdata, na.action = na.action, xlev = object$xlevels) : variable lengths differ (found for 'REP') I keep getting this error and I am not sure how to fix it, the same code work for chlorophyll content

rfB1 <-train(LAI~B11+REP+CIRE+B6+SR9, data=GGHNP_Data, method="rf",trControl= trControl)
rfB1

b11<- raster("C:/GGHNP/Band11.tif")
rep<-raster("C:/GGHNP/REP.tif")
cire<-raster("C:/GGHNP/CIRE.tif")
b6<-raster("C:/GGHNP/Band6.tif")
sr9<- raster("C:/GGHNP/SR9.tif")

s<- stack(b11,rep,cire,b6,sr9)
lai_gghnp<- predict(s, rfB1, na.action= na.pass)
plot(lai_gghnp, main = "LAI_GGHNP")

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

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.