title: dplyr - mutate with variable column names
body: <p>I have a tibble containing time series of various blood parameters like CRP over the course of several days. The tibble is tidy, with each time series in one column, as well as a column for the day of measurement. The tibble contains another column with a day of infection. I want to replace each blood parameter with NA if the Day variable is greater-equal than the InfectionDay. Since I have a lot of variables, I'd like to have a function which accepts the column name dynamically and creates a new column name by appending "_censored" to the old one. I've tried the following:</p>
  
  <pre><code>censor.infection &lt;- function(df, colname){
      newcolname &lt;- paste0(colname, "_censored")
      return(df %&gt;% mutate(!!newcolname := ifelse( Day &lt; InfectionDay, !!colname, NA)))
  }
  
  data = tibble(Day=1:5, InfectionDay=3, CRP=c(3,2,5,4,1))
  data = censor.infection(data, "CRP")
  </code></pre>
  
  <p>Running this, I expected</p>
  
  <pre><code># A tibble: 5 x 4
      Day InfectionDay   CRP CRP_censored
    &lt;int&gt;        &lt;dbl&gt; &lt;dbl&gt; &lt;chr&gt;       
  1     1            3     3 3         
  2     2            3     2 2         
  3     3            3     5 NA          
  4     4            3     4 NA          
  5     5            3     1 NA 
  </code></pre>
  
  <p>but I get</p>
  
  <pre><code># A tibble: 5 x 4
      Day InfectionDay   CRP CRP_censored
    &lt;int&gt;        &lt;dbl&gt; &lt;dbl&gt; &lt;chr&gt;       
  1     1            3     3 CRP         
  2     2            3     2 CRP         
  3     3            3     5 NA          
  4     4            3     4 NA          
  5     5            3     1 NA 
  </code></pre>