title: Confusion matrix R
body: <p>I am struggling with this confusion matrix application:</p>
  
  <pre><code>lvs &lt;- c("normal", "abnormal")
  truth &lt;- factor(rep(lvs, times = c(86, 258)),
  levels = rev(lvs))
  pred &lt;- factor(
  c(
  rep(lvs, times = c(54, 32)),
  rep(lvs, times = c(27, 231))),
  levels = rev(lvs))
  xtab &lt;- table(pred, truth)
  </code></pre>
  
  <p>Basically, I am confused with line number 2, 6 and 7. Below you can see the result after running the code. But I am still confused what I have to put into the brackets. Of course, I know the values were just an example but in the tutorial it wasn't explained what these values mean.</p>
  
  <p><a href="https://artax.karlin.mff.cuni.cz/r-help/library/caret/html/confusionMatrix.html" rel="nofollow noreferrer">https://artax.karlin.mff.cuni.cz/r-help/library/caret/html/confusionMatrix.html</a></p>
  
  <pre><code>truth
  pred   abnormal  normal
  abnormal   231       32
  normal     27        54
  </code></pre>
  
  <p>Thank you for your help!</p>