title: Group/Mutate only returns NA and not an average
body: <p>Using R 3.5, R studio 1.1.419.</p>
  
  <p>I have a dataset that contains geographic data and a city based measures.</p>
  
  <pre><code>    zip state        city statefips finmei14 finmei15
  1   501    NY  Holtsville        36       NA       NA
  2   544    NY  Holtsville        36       NA       NA
  3  1001    MA      Agawam        25       NA       NA
  4  1002    MA     Amherst        25       69       64
  5  1003    MA     Amherst        25       69       64
  6  1004    MA     Amherst        25       69       64
  7  1005    MA       Barre        25       NA       NA
  8  1007    MA Belchertown        25       NA       NA
  9  1008    MA   Blandford        25       NA       NA
  10 1009    MA  Bondsville        25       NA       NA
  </code></pre>
  
  <p>finmei14 and finmei15 are city based measures that I want to aggregate by state so there will be a new variable that takes the average of the city measures into a new state measure (stat14 and stat15).  I tried to use group_by and mutate</p>
  
  <pre><code>testdat %&gt;% 
    group_by(state) %&gt;%
    mutate (stat14=mean(finmei14))
  </code></pre>
  
  <p>My result was stat14 having nothing but NA's.</p>
  
  <pre><code>    zip state        city statefips finmei14 finmei15 stat14
  1   501    NY  Holtsville        36       NA       NA     NA
  2   544    NY  Holtsville        36       NA       NA     NA
  3  1001    MA      Agawam        25       NA       NA     NA
  4  1002    MA     Amherst        25       69       64     NA
  5  1003    MA     Amherst        25       69       64     NA
  6  1004    MA     Amherst        25       69       64     NA
  7  1005    MA       Barre        25       NA       NA     NA
  8  1007    MA Belchertown        25       NA       NA     NA
  9  1008    MA   Blandford        25       NA       NA     NA
  10 1009    MA  Bondsville        25       NA       NA     NA
  </code></pre>
  
  <p>I've also tried to add na.rm=TRUE but it returned this result</p>
  
  <pre><code>testdat %&gt;% 
    group_by(state) %&gt;%
    mutate (stat14=mean(finmei14), na.rm=TRUE)
  
       zip state city        statefips finmei14 finmei15 stat14 na.rm
   1  501. NY    Holtsville        36.      NA       NA      NA TRUE 
   2  544. NY    Holtsville        36.      NA       NA      NA TRUE 
   3 1001. MA    Agawam            25.      NA       NA      NA TRUE 
   4 1002. MA    Amherst           25.      69.      64.     NA TRUE 
   5 1003. MA    Amherst           25.      69.      64.     NA TRUE 
   6 1004. MA    Amherst           25.      69.      64.     NA TRUE 
   7 1005. MA    Barre             25.      NA       NA      NA TRUE 
   8 1007. MA    Belchertown       25.      NA       NA      NA TRUE 
   9 1008. MA    Blandford         25.      NA       NA      NA TRUE 
  10 1009. MA    Bondsville        25.      NA       NA      NA TRUE 
  </code></pre>
  
  <p>What I want to see (based on this sample) is</p>
  
  <pre><code>    zip state        city statefips finmei14 finmei15 stat14
  1   501    NY  Holtsville        36       NA       NA     NA
  2   544    NY  Holtsville        36       NA       NA     NA
  3  1001    MA      Agawam        25       NA       NA     69
  4  1002    MA     Amherst        25       69       64     69
  5  1003    MA     Amherst        25       69       64     69
  6  1004    MA     Amherst        25       69       64     69
  7  1005    MA       Barre        25       NA       NA     69
  8  1007    MA Belchertown        25       NA       NA     69
  9  1008    MA   Blandford        25       NA       NA     69
  10 1009    MA  Bondsville        25       NA       NA     69
  </code></pre>
  
  <p>Thank you.</p>