I've set up my random forests model very well, see the code
modelRF <- randomForest(x=p$NDVI,
y=p$BushCategories,
ntree=500, do.trace=TRUE,
importance=TRUE, forest=TRUE, na.action=na.omit)
but then it gives the error below
Error in if (n == 0) stop("data (x) has 0 rows") :
argument is of length zero
See the structure of my data below
'data.frame': 197 obs. of 5 variables:
$ Waypoint_No : chr "OMATSC028" "OMATSC200" "OMATSC072N" "OMATSC317" ...
$ Longitude : num 17.7 17.6 17.8 17.9 17.9 ...
$ Latitude : num -21.2 -21.2 -21.1 -20.9 -21.1 ...
$ NDVI : num 0.256 0.327 0.25 0.268 0.283 ...
$ BushCategories: Factor w/ 4 levels "0-25%","26-50%",..: 3 1 2 3 2 3 1 2 1
1 ...
What could be the problem?
Here is a sample of how my dataset looks like
x<-c('0.256', '0.327', '0.25', '0.268')
y<-c('0-25%','26-50%','51-75%','76-100%')
data<-data.frame(x,y)