title: how to rename a variable using a dynamic name and dplyr?
body: <p>I want to rename a column inside a function with a name passed as an argument for this function. Basically, I have a function</p>
  
  <pre><code>produce_data_frame &lt;- function(name) {
    return(iris)
  }
  </code></pre>
  
  <p>And I want that this function change the Sepal.length column name with 'name' (with name taking the value of name)
  I tried different things such as </p>
  
  <pre><code>produce_data_frame &lt;- function(name) {
    name &lt;- enquo(name)
    iris %&gt;%
      rename((!!name) = Sepal.Length) %&gt;%
      return()
  }
  </code></pre>
  
  <p>And when calling </p>
  
  <pre><code>produce_data_frame("newName")
  </code></pre>
  
  <p>I would like to get back the iris data.frame with the Sepal.Length column named newName. But my understanding of NSE is still very basic, and it doesn't even compile.</p>