My data looks like:
A,B,C,D,Class
1,2,0,2,cl1
1,5,1,9,cl1
3,2,1,2,cl2
7,2,1,2,cl2
2,2,1,2,cl2
1,2,1,5,cl2
0,2,1,2,cl2
4,2,1,2,cl2
3,5,1,2,cl2
3,2,12,3,cl2
3,2,4,2,cl2

**The steps followed are:
trainfile <- read.csv("TrainFile",head=TRUE)
datatrain <- subset(trainfile,select=c(-Class))
classtrain <- (subset(trainfile,select=Class))
rf <- randomForest(datatrain, classtrain)

Error in randomForest.default(classtrain, datatrain) :
  length of response must be the same as predictors
In addition: Warning message:
In randomForest.default(classtrain, datatrain) :
  The response has five or fewer unique values.  Are you sure you want to do
regression?

Could someone suggest me where I am going wrong.

Thanks

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to