title: R - Caret - Using ROC instead of accuracy in model training
body: <p>Hi my name is Abhi and I am using caret to build a gbm trees based model. However instead of accuracy I would like to use roc as my metric</p>
  
  <p>Here is the code I have so far</p>
  
  <pre><code>myTuneGrid &lt;- expand.grid(n.trees = 500,interaction.depth = 11,shrinkage = 0.1)
  fitControl &lt;- trainControl(method = "repeatedcv", number = 7,repeats = 1, verboseIter = FALSE,returnResamp = "all",classProbs = TRUE)
  myModel &lt;- train(Cover_Type ~ .,data = modelData,method = "gbm",trControl = fitControl,tuneGrid = myTuneGrid,metric='roc')
  </code></pre>
  
  <p>However when I run this code I get a warning</p>
  
  <pre><code>Warning message:
  In train.default(x, y, weights = w, ...) :
  The metric "roc" was not in the result set. Accuracy will be used instead.
  </code></pre>
  
  <p>How do I force my model to use roc instead of accuracy. What am I doing wrong here?</p>