title: R: create new column with name coming from variable
body: <p>I have a dataframe with several columns and would like to add a new column and name it according to a previous variable. For example:</p>
  
  <pre><code>df &lt;- data.frame("A" = c(1, 2, 3, 4), "B" = c("a", "c", "d", "b"))
  Variable &lt;- "C"
  </code></pre>
  
  <p>This is part of a function where the variable will be changing and rather than each time specifying:</p>
  
  <pre><code>df$C &lt;- NA
  </code></pre>
  
  <p>I would like a one line that will take the "Variable" to name the additional column</p>