i am selecting features using the random forest algorithm shown below
x=trainpreg[,-which(names(trainpreg) %in% c("status"))]
y=trainpreg[,which(names(trainpreg) %in% c("status"))]
df1 <- (data.matrix(x))
df2 <- (data.matrix(y))
RFMod <- train(x=df1,y=df2,method="rf",metric="ROC",trControl=ctrl)
this is the error i get after running it "Error in y[, "time"] : subscript out of bounds"
how do i solve this error