title: Working with temporary columns (created on-the-fly) more efficiently in a dataframe
body: <p>Consider the following dataframe:</p>
  
  <p><code>df &lt;- data.frame(replicate(5,sample(1:10, 10, rep=TRUE)))</code></p>
  
  <p>If I want to divide each row by its sum (to make a probability distribution), I need to do something like this:</p>
  
  <p><code>df %&gt;% mutate(rs = rowSums(.)) %&gt;% mutate_each(funs(. / rs), -rs) %&gt;% select(-rs)</code></p>
  
  <p>This <em>really</em> feels inefficient: </p>
  
  <ol>
  <li>Create an <code>rs</code> column </li>
  <li>Divide each of the values by their corresponding row <code>rowSums()</code></li>
  <li>Remove the temporarily created column to clean up the original dataframe.</li>
  </ol>
  
  <p>When working with existing columns, it feels much more natural:</p>
  
  <p><code>df %&gt;% summarise_each(funs(weighted.mean(., X1)), -X1)</code></p>
  
  <p>Using <code>dplyr</code>, would there a better way to work with temporary columns (created on-the-fly) than having to add and remove them after processing ?</p>
  
  <p>I'm also interested in how <code>data.table</code> would handle such a task.</p>