title: Unable to pass variable arguments to dplyr using a function in R
body: <p>I am unable to pass variable arguments to <code>dplyr</code> using a function. A mock version of the function is </p>
  
  <pre><code>Fun.function(data, var.1, var.2) {
  data %&gt;% 
  group_by_(var.1) %&gt;%
  summarise_(mean.var.2 = mean(var.2))
  }
  </code></pre>
  
  <p>The error is </p>
  
  <blockquote>
    <p>Error: Index out of bounds</p>
  </blockquote>
  
  <p>It will be great if someone can help me with this.</p>