title: How to pass a column name as an argument of a function which uses dplyr, without passing it as a string?
body: <p>Here: <a href="https://rpubs.com/hadley/dplyr-programming" rel="nofollow noreferrer">https://rpubs.com/hadley/dplyr-programming</a> they write the following.</p>
  
  <pre><code>my_summarise &lt;- function(df, group_by) {
    group_by &lt;- enquo(group_by)
    print(group_by)
  
    df %&gt;%
      group_by(!!group_by) %&gt;%
      summarise(a = mean(a))
  }
  
  my_summarise(df, g1)
  #&gt; ~g1
  #&gt; # A tibble: 2 × 2
  #&gt;      g1     a
  #&gt;   &lt;dbl&gt; &lt;dbl&gt;
  #&gt; 1     1   4.5
  #&gt; 2     2   2.0
  </code></pre>
  
  <p>So I try to copy it, using my idea of a function and my data.</p>
  
  <pre><code>library(MASS)
  not.fun &lt;- function(data, column) {
    column &lt;- enquo(column)
    data %&gt;% slice(1:10) %&gt;% select(!!column)
  }
  
  not.fun(MASS::Cars93, Length)
  Error in select(., !!column) : unused argument (!!column) 
  </code></pre>
  
  <p>But, guess what, it doesn't work.
  How to make it work, without using strings?
  I would be interested in a result possibly done in base R if it'd take as many lines of code to write as a result in some specific package.</p>