title: Training error rate in `caret`
body: <p>I don't know how to extract the training error (i.e., the error obtained on the training set) using the <code>caret</code> package in <code>R</code>. For example, I have the following model:</p>
  
  <pre><code>data(iris);
  library(caret);
  model&lt;-train(Species~., data=iris, method='knn', trControl=trainControl(method='cv', number=10), tuneGrid=data.frame(k=20))
  </code></pre>
  
  <p>What I want to do is to see how well the model performed <strong>on the training data</strong>.</p>
  
  <p>I know I can get the performance on the test set for each fold using <code>model$results</code>, but that's not what I want. I want to show how the training error is <em>way</em> over-optimistic, but I can't do that. The documentation here:</p>
  
  <p><a href="http://www.inside-r.org/packages/cran/caret/docs/train" rel="nofollow">http://www.inside-r.org/packages/cran/caret/docs/train</a></p>
  
  <p>states that </p>
  
  <blockquote>
    <p><code>results</code>: a data frame the training error rate and values of the tuning
    parameters.</p>
  </blockquote>
  
  <p>which is <strong>not</strong> true, because in my case, <code>model$results$Accuracy</code> is always <strong>exactly</strong> equal to the value of <code>mean(model$resample$Accuracy)</code>. This is the value of the <em>testing</em> error rate. I want the <em>training</em> eror rate. Is there a way to get it?</p>