R : creating new data from column with string variable name : <p>I have string variable, <code>str</code>, with the value <code>"car"</code>.  I would like to create a new column in my data frame using <code>str</code>, but creates a column with the name <code>"car"</code>.  Below is a short example. </p>

<pre><code>a&lt;-c("Bill", "Jo", "Sue")
b&lt;-c(3,4,10)
d&lt;-c("Red", "Blue", "Yellow")
df&lt;-data.frame(b,d,row.names=a)
colnames(df)&lt;-c("age","favorite_color")
df
         age favorite_color
    Bill   3            Red
    Jo     4           Blue
    Sue   10         Yellow
str&lt;-"car"
df$str&lt;-character(nrow(df))
df
         age favorite_color  str
    Bill   3            Red      
    Jo     4           Blue      
    Sue   10         Yellow      
</code></pre>

<p>Is there a way to evaluate <code>str</code> while creating the new data frame column such that the column name is <code>"car"</code>.</p>
