I am naive in R markdown. I found my code works well in R and give outputs properly. However, when I am run them in R Markdown, the process stops at a line

err.vect[i] eval -> eval -> roc.area -> Summary.factor Execution halted.

```{r}

for (i in 1:k){

s1 = ((i-1) * n+1) # the start of the subset

s2 = (i*n) # The end of the subset

subset = s1:s2 # the range of the subset

cv.train=rh.df[-subset,] # Train the model using this data

cv.test = rh.df[subset, ] # test the model's performace on this data

# run the random forest on the training data set, exclude on predictor variables

fit = randomForest (x=cv.train[,-c(1,2,3,32)], y= as.factor (cv.train[,32]))

prediction = predict (fit, newdata= cv.test[, -c(1,2,3,32)], type="prob")[,2]

# calculate the model's accurancy for the ith fold

err.vect[i]

More Madan K. Suwal's questions See All
Similar questions and discussions