title: R program question: What code I have to use to calculate 3 columns into one column?
body: <p>In example we have:</p>
  
  <pre><code>   treetype Leaves roots
  1.   1        670    25
  2.   4        330    55
  3.   8        880    55
  4.   3        770    25
  </code></pre>
  
  <p>Wanted solution:</p>
  
  <pre><code>   New value
  1. 696   (1+670+25)
  2. 389   (4+330+55)
  3. and so on
  </code></pre>
  
  <p>And second question:<br>
  if value doesn't meet required value, i.e. 550 then calculate new value using only leaves.<br>
  -> 2. row in wanted solution should be 330.</p>
  
  <p>any tips?</p>