title: r dplyr group_by - by variable content
body: <p>I use dplyr group_by function to group my data frame, </p>
  
  <p>and need to be able to group the data, by a column, i don't know the name of the column yet, i need to decide it along the code, so the name can't be hard coded. </p>
  
  <p>for example, </p>
  
  <p>i can't use </p>
  
  <pre><code>data %&gt;% group_by(col_name) 
  </code></pre>
  
  <p>i need to do somthing like </p>
  
  <pre><code>data %&gt;% c &lt;- col_name 
  data %&gt;% group_by(c)
  </code></pre>
  
  <p>when i try doing so, it popes error:
  Error: unknown variable to group by : c </p>
  
  <p>All the examples I find are for the trevial case when you can hard code the name of the column</p>
  
  <p><a href="https://stats.stackexchange.com/questions/8225/how-to-summarize-data-by-group-in-r">group by example</a></p>
  
  <p>Same in the r help</p>
  
  <p>Thanks.</p>