title: Select value from row to use in calculation
body: <p>I am trying to select the value from a row where a column has a particular value so I can use it in a calculation. i have tried to use dput but it appears not to work -- at least using the instructions on stackoverflow for producing a reproducible example.</p>
  <pre><code> total.history &lt;-           sum(recommendation$Spent[recommendation$Account==&quot;History&quot;])
  </code></pre>
  <pre><code>$ Account: chr  &quot;Art&quot; &quot;Biology&quot; &quot;Botany&quot; &quot;Languages&quot; ...
       $ Product: chr  &quot;Humanities&quot; &quot;Science&quot; &quot;Science&quot; &quot;Humanities&quot; ...
       $ Region : chr  &quot;Art&quot; &quot;Biology&quot; &quot;Botany&quot; &quot;Languages&quot; ...
       $ Revenue: int  2000 75 1000 1000 200 200 5000 100 100 200
       $ Spent  : int  1000 30 444 234 100 123 250 56 23 156
       $ Left   : int  1000 45 556 766 100 77 4750 44 77 44
  </code></pre>