title: Issue using 'ROC' metric in caret train function in R
body: <p>I have an imbalanced data set with two classes therefore I thought I could use ROC as a metric instead of Accuracy to tune my model in R using caret package (I am trying different methods such as rpart, rf..etc). I thought we could extract probabilities and use ROC as a metric in decision tree type algorithms as well using caret. I illustrate my problem using a data set in caret below. There are three classes in this data but I redefined and created two classes for illustration purposes. I don't understand why the below code gives this error (I keep getting the same error when I change the method). I appreciate your help.</p>
  
  <p>'Error in train.default(x, y, weights = w, ...) : final tuning parameters could not be determined 
  In addition: Warning messages: 
  1: In nominalTrainWorkflow(x = x, y = y, wts = weights, info = trainInfo, : There were missing values in resampled performance measures. 
  2: In train.default(x, y, weights = w, ...) : missing values found in aggregated results'</p>
  
  <pre><code>library(caret) 
  data(iris)
  
  iris$Species=as.character(iris$Species)
  iris$Species[which(iris$Species=='virginica')]='versicolor'
  iris$Species=as.factor(iris$Species)
  
  fitControl &lt;- trainControl(method = "cv",number=5,classProbs = TRUE,summaryFunction = twoClassSummary)
  
  RF=train(Species ~ ., data = iris, method="rpart",metric="ROC", trControl=fitControl)
  </code></pre>