title: confusion matrix from rpart
body: <p>I can't for the life of me figure out how to compute a confusion matrix on rpart. </p>
  
  <p>Here is what I have done:</p>
  
  <pre><code>set.seed(12345)
  UBANK_rand &lt;- UBank[order(runif(1000)), ]
  UBank_train &lt;- UBank_rand[1:900, ]
  UBank_test  &lt;- UBank_rand[901:1000, ]
  
  
  dim(UBank_train)
  dim(UBank_test)
  
  #Build the formula for the Decision Tree
  UB_tree &lt;- Personal.Loan ~ Experience + Age+ Income +ZIP.Code + Family + CCAvg + Education
  
  #Building the Decision Tree from Test Data
  UB_rpart &lt;- rpart(UB_tree, data=UBank_train)
  </code></pre>
  
  <p>Now, I would think I would do something like</p>
  
  <pre><code>table(predict(UB_rpart, UBank_test, UBank_Test$Default))
  </code></pre>
  
  <p>But that is not giving me a confusion matrix.</p>