While trying to train randomForest with my dataset, I am ending up with the
following error
Error in randomForest.default(datatrain, classtrain) :
  length of response must be the same as predictors

My data looks like:
A,B,C,D,Class
1,2,1,2,cl1
1,2,1,2,cl1
3,2,1,2,cl2
3,2,1,2,cl2
3,2,1,2,cl2
3,2,1,2,cl2
3,2,1,2,cl2
3,2,1,2,cl2
3,2,1,2,cl2
3,2,12,3,cl2
3,2,1,2,cl2
Actual dataset has around 4000 features and two classes. And number of
instances is also around 4000.

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(datatrain, classtrain) :
  length of response must be the same as predictors
In addition: Warning message:
In randomForest.default(datatrain, classtrain) :
  The response has five or fewer unique values.  Are you sure you want to do
regression?

Where I am going wrong?

If I follow the example provided in documentation (Classification and
Regression with Random Forest)
rf <- randomForest(classtrain, data=datatrain)
I dont get randomForest of type: classification
I get:

Call:
 randomForest(x = classtrain, data = datatrain)
               Type of random forest: unsupervised
                     Number of trees: 500
No. of variables tried at each split: 1

Any suggestion would be appreciated.

Thanks

	[[alternative HTML version deleted]]

