title: Extract probabilities from decision trees
body: <p>I need to extract the path and probability of each leaf in a decision tree. Here's a quick sample to work with:</p>
  
  <pre><code>data(iris)
  
  model&lt;-rpart(Species~., data=iris)
  
  summary(model)
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/N20qr.png" alt="enter image description here"></p>
  
  <p>I'd like to be able to extract all of that information in summary here such as "predicted class" , "class counts" and "probabilities" in a format that I can put into a table rather than just being able to read it on the console. </p>
  
  <p>Much thanks!</p>