title: Show the outcome of decision tree in a confusionmatrix
body: <p>I trying to predict the outcome of a match. Therefore Im using the rpart algoritm on a test and training set.</p>
  
  <p>When im training my algoritm I do this:</p>
  
  <pre><code> tree &lt;- rpart(won ~ EXPG1 + EXPG2, data=training, method="class")
  </code></pre>
  
  <p>And with this I predict whether a match will have 0,1 or 2 as endresult.</p>
  
  <pre><code> predict &lt;- predict(tree, testing)
  </code></pre>
  
  <p>Which leads to the following result:</p>
  
  <pre><code> head(predict)
         0         1         2
  2  0.7368421 0.1578947 0.1052632
  7  0.2777778 0.5000000 0.2222222
  </code></pre>
  
  <p>This all works fine. But now I would like to compare my results in confusionmatrix.</p>
  
  <p>But this obviously doesnt work</p>
  
  <pre><code>confusionMatrix(testing$won, predict)
  </code></pre>
  
  <p>Because my testing$won column only contains 0,1 or 2. Any advice on how I can view my results in a confusionmatrix?</p>