title: group_by dplyr is not grouping
body: <p>Ok, so I've read lots of posts here and I'm kind of embarrassed because I thought I understood the basic <code>dplyr</code>functions.</p>
  
  <p>I can't get <code>group_by</code> to form groups and I am perplexed.</p>
  
  <p>I have the data frame <code>test</code>. All I want is to group by the variable <code>ID</code> and then calculate the correlation between two variables per group.</p>
  
  <p>I don't know what's happening because it doesn't group and only outputs 1 correlation when I should have 127 groups and 127 correlations. WHY?</p>
  
  <p>What <code>test</code> looks like:</p>
  
  <p><a href="https://i.stack.imgur.com/OabGR.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OabGR.png" alt="enter image description here"></a></p>
  
  <p>What I wrote:</p>
  
  <pre><code>library(dplyr)
  library(magrittr)
  test%&gt;%
    mutate(ID=as.character(ID))%&gt;%
    group_by(ID)%$%
    cor(sulfate,nitrate,use="complete.obs")
  </code></pre>
  
  <p>What I get: <code>[1] 0.0568084</code>.</p>