title: Saving decision tree's output into a text file
body: <p>I'm looking for a method to save decision tree's output in <code>R</code>. Here is a simple decision tree code in <code>R</code>:</p>
  
  <pre><code>library(rpart)
  data(kyphosis)
  fit &lt;- rpart(Kyphosis ~ Age + Number + Start, data = kyphosis)
  </code></pre>
  
  <p>and here is the value of <code>fit</code>:</p>
  
  <pre><code>1) root 81 17 absent (0.79012346 0.20987654)  
     2) Start&gt;=8.5 62  6 absent (0.90322581 0.09677419)  
       4) Start&gt;=14.5 29  0 absent (1.00000000 0.00000000) *
       5) Start&lt; 14.5 33  6 absent (0.81818182 0.18181818)  
        10) Age&lt; 55 12  0 absent (1.00000000 0.00000000) *
        11) Age&gt;=55 21  6 absent (0.71428571 0.28571429)  
          22) Age&gt;=111 14  2 absent (0.85714286 0.14285714) *
          23) Age&lt; 111 7  3 present (0.42857143 0.57142857) *
     3) Start&lt; 8.5 19  8 present (0.42105263 0.57894737) *
  </code></pre>
  
  <p>I tried <code>save</code>, <code>dump</code> and <code>dput</code> but they do not work and change tree's format. Is there any method to save the tree into a text file keeping its? <code>sink</code> does not work for me.</p>