Use a vector/index as a row name in a dataframe using rbind
<p>I think I'm missing something super simple, but I seem to be unable to find a solution directly relating to what I need: I've got a data frame that has a letter as the row name and a two columns of numerical values. As part of a loop I'm running I create a new vector (from an index) that has both a letter and number (e.g. "f2") which I then need to be the name of a new row, then add two numbers next to it (based on some other section of code, but I'm fine with that). What I get instead is the name of the vector/index as the title of the row name, and I'm not sure if I'm missing a function of rbind or something else to make it easy.  </p>

<p>Example code:  </p>

<pre><code>#Data frame and vector creation
row.names &lt;- letters[1:5]
vector.1 &lt;- c(1:5)
vector.2 &lt;- c(2:6)
vector.3 &lt;- letters[6:10]
data.frame &lt;- data.frame(vector.1,vector.2)
rownames(data.frame) &lt;- row.names
data.frame

index.vector &lt;- "f2" 

#what I want the data frame to look like with the new row
data.frame &lt;- rbind(data.frame, "f2" = c(6,11))
data.frame

#what the data frame looks like when I attempt to use a vector as a row name
data.frame &lt;- rbind(data.frame, index.vector = c(6,11))
data.frame

#"why" I can't just type "f" every time
index.vector2 = paste(index.vector, "2", sep="")
data.frame &lt;- rbind(data.frame, index.vector2 = c(6,11))
data.frame
</code></pre>

<p>In my loop the "index.vector" is a random sample, hence where I can't just write the letter/number in as a row name, so need to be able to create the row name from a vector or from the index of the sample.  </p>

<p>The loop runs and a random number of new rows will be created, so I can't specify what number the row is that needs a new name - unless there's a way to just do it for the newest or bottom row every time.  </p>

<p>Any help would be appreciated!</p>