title: How to pass a variable name in group_by
body: <p>I can calculate the rank of the values (val) in my dataframe df within the group name1 with the code:</p>
  
  <pre><code>res  &lt;- df %&gt;% arrange(val) %&gt;% group_by(name1) %&gt;% mutate(RANK=row_number()) 
  </code></pre>
  
  <p>Instead of writing the column "name1" in the code, I want to pass it as variable, eg crit = "name1". However, the code below does not work since crit1 is assumed to be the column name instead of a variable name.</p>
  
  <pre><code>res  &lt;- df %&gt;% arrange(val) %&gt;% group_by(crit1) %&gt;% mutate(RANK=row_number()) 
  </code></pre>
  
  <p>How can I pass crit1 in the code?</p>
  
  <p>Thanks,
  Tom</p>