title: How to get the average of two columns using dplyr?
body: <p>how to get the average of two columns of a data table using dplyr? For example, if my data if like below: </p>
  
  <pre><code>dt &lt;- data.table(A=1:5, B=c(1,4,NA,6,8))
  </code></pre>
  
  <p>I want to create a new column "Avg" which is the mean of column A and B for each row:</p>
  
  <pre><code>dt %&gt;% mutate(Avg=mean(c(A, B), na.rm=T))
  </code></pre>
  
  <p>But this code does not give me the correct result. How to do this? Thank you very much.</p>