title: R use value of a variable as a data frame column name
body: <p>I am guessing this is simple for an experienced used...how can I use the value of a variable to assign it as a data frame column name?  Say I have a simple data frame df as below, and a variable n that changes value based on user input.  How could I insert a new data frame column  which has as it's name the value of n?  I would also ideally like to concatenate the value of n with a simple string.  Thank you.</p>
  
  <pre><code>df&lt;-data.frame(a=c(1,1,1),b=c(2,2,2))
  
    a b
  1 1 2
  2 1 2
  3 1 2
  </code></pre>
  
  <p>When I simply try to assign a new column as </p>
  
  <pre><code>n&lt;-15
  df$n&lt;-c(3,3,3)
  </code></pre>
  
  <p>the name of the column is simply n.    </p>
  
  <pre><code>  a b n
  1 1 2 3
  2 1 2 3
  3 1 2 3
  </code></pre>