title: Summarizing by dynamic column name in dplyr
body: <p>So I'm trying to do some programming in dplyr and I am having some trouble with the enquo and !! evaluations. </p>
  
  <p>Basically I would like to mutate a column to a dynamic column name, and then be able to further manipulate that column (i.e. summarize). For instance:</p>
  
  <pre><code>my_function &lt;- function(data, column) {
  
    quo_column &lt;- enquo(column)
  
    new_col &lt;- paste0(quo_column, "_adjusted")[2]
  
    data %&gt;%
       mutate(!!new_col := (!!quo_column) + 1) 
    }
  
  my_function(iris, Petal.Length)
  </code></pre>
  
  <p>This works great and returns a column called "Petal.Length.adjusted" which is just Petal.Length increased by one. </p>
  
  <p>However I can't seem to summarize this new column. </p>
  
  <pre><code>my_function &lt;- function(data, column) {
  
    quo_column &lt;- enquo(column)
  
     new_col &lt;- paste0(quo_column, "_adjusted")[2]
  
     mean_col &lt;- paste0(quo_column, "_meanAdjusted")[2]
  
     data %&gt;%
        mutate(!!new_col := (!!quo_column) + 1) %&gt;%
        group_by(Species) %&gt;%
        summarize(!!mean_col := mean(!!new_col))
  }
  
  my_function(iris, Petal.Length)
  </code></pre>
  
  <p>This results in a warning stating the argument "Petal.Length_adjusted" is not numeric or logical, although the output from the mutate call gives a numeric column.</p>
  
  <p>How do I reference this dynamically generated column name to pass it in further dplyr functions?</p>