title: Specifying positive class of an outcome variable in caret train()
body: <p>I'm wondering if there is a way to specify which class of the outcome variable is positive in caret's <code>train()</code> function. A minimal example:</p>
  
  <pre><code># Settings
  ctrl &lt;- trainControl(method = "repeatedcv", number = 10, savePredictions = TRUE, summaryFunction = twoClassSummary, classProbs = TRUE)
  
  # Data
  data &lt;- mtcars %&gt;% mutate(am = factor(am, levels = c(0,1), labels = c("automatic", "manual"), ordered = T))
  
  # Train
  set.seed(123)
  model1 &lt;- train(am ~ disp + wt, data = data, method = "glm", family = "binomial", trControl = ctrl, tuneLength = 5)
  
  # Data (factor ordering switched)
  data &lt;- mtcars %&gt;% mutate(am = factor(am, levels = c(1,0), labels = c("manual", "automatic"), ordered = T))
  
  # Train
  set.seed(123)
  model2 &lt;- train(am ~ disp + wt, data = data, method = "glm", family = "binomial", trControl = ctrl, tuneLength = 5)
  
  # Specifity and Sensitivity is switched
  model1
  model2
  </code></pre>
  
  <p>If you run the code, you'll notice that Specificity and Sensitivity metrics are "switched" in both models. It looks like the <code>train()</code> function takes the first level of a factor outcome variable as a positive outcome. Is there a way to specify a positive class in the function itself so I will get the same results no matter of the outcome factor ordering? I tried adding <code>positive = "manual"</code> but this results in an error.</p>