RandomForest error code

2019-09-02 14:09发布

I am trying to run a rather simple randomForest. I keep having an error code that does not make any sense to me. See code below.

test.data<-data.frame(read.csv("test.RF.data.csv",header=T))
attach(test.data)
head(test.data)

Depth<-Data1
STemp<-Data2
FPT<-Sr_hr_15
Stage<-stage_feet
Q<-discharge_m3s
V<-vel_ms
Turbidity<-turb_ntu
Day_Night<-day_night 

FPT.rf <- randomForest(FPT ~ Depth + STemp + Q + V + Stage + Turbidity + Day_Night,    data = test.data,mytry=1,importance=TRUE,na.action=na.omit)

Error in randomForest.default(m, y, ...) : data (x) has 0 rows In addition: Warning message: In randomForest.default(m, y, ...) : The response has five or fewer unique values. Are you sure you want to do regression? I then run the dimensions to ensure there is infact data recognized in R

dim(test.data)

[1] 77 15

This is a subset of the complete data set I ran just to test if I could get it to run since I got the same error with the complete data set.

Why is it telling me data(x) has 0 rows when clearly there is.

Thanks

0条回答
登录 后发表回答