title: Aggregating in R per ID but keeping the ID repetitions
body: <p>If I have the table</p>
  
  <pre><code>ID  1 1 1 2 2
  N.  3 2 1 1 1
  </code></pre>
  
  <p>I want to get the same number of rows but with a new column that would be the mean of N per ID. </p>
  
  <p>Ie</p>
  
  <pre><code>ID            1. 1 1 2 2
  N.            3  2 1 1 1
  Mean(N)       2  2 2 1 1
  </code></pre>
  
  <p>How to do that in R?</p>