title: print decision tree in text nicely / with custom control [r]
body: <p>I'd like to print a decision tree in text nicely. For example, I can print the tree object itself:</p>
  
  <pre><code>library(rpart)
  
  f = as.formula('Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width + Species')
  fit = rpart(f, data = iris, control = rpart.control(xval = 3))
  
  fit
  </code></pre>
  
  <p>yields</p>
  
  <pre><code>n= 150 
  
  node), split, n, deviance, yval
        * denotes terminal node
  
   1) root 150 102.1683000 5.843333  
     2) Petal.Length&lt; 4.25 73  13.1391800 5.179452  
       4) Petal.Length&lt; 3.4 53   6.1083020 5.005660  
         8) Sepal.Width&lt; 3.25 20   1.0855000 4.735000 *
         9) Sepal.Width&gt;=3.25 33   2.6696970 5.169697 *
  ... # omitted
  </code></pre>
  
  <p><code>partykit</code> prints it neater:</p>
  
  <pre><code>library(partykit)
  
  as.party(fit)
  </code></pre>
  
  <p>yields</p>
  
  <pre><code>Model formula:
  Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width + Species
  
  Fitted party:
  [1] root
  |   [2] Petal.Length &lt; 4.25
  |   |   [3] Petal.Length &lt; 3.4
  |   |   |   [4] Sepal.Width &lt; 3.25: 4.735 (n = 20, err = 1.1)
  |   |   |   [5] Sepal.Width &gt;= 3.25: 5.170 (n = 33, err = 2.7)
  |   |   [6] Petal.Length &gt;= 3.4: 5.640 (n = 20, err = 1.2)
  ...# omitted
  
  Number of inner nodes:    6
  Number of terminal nodes: 7
  </code></pre>
  
  <p>Is there a way I have have more control? Eg, I don't want to print <code>n</code> and <code>err</code>, or want standard deviation instead of <code>err</code> printed.</p>