title: Change the rownames of a data frame in R
body: <p>I've dataframe <code>df</code> and I've a list <code>list</code> containing the names of the rows of the data frame.<br>
  <code>df</code> looks like:  </p>
  
  <pre><code>x  y  
  5  6  
  2 1  
  9 5  
  2 2   
  </code></pre>
  
  <p><code>list</code> looks like:  </p>
  
  <pre><code>doc1  
  doc2
  </code></pre>
  
  <p>I want to combine the list with the data frame, so that the dataframe has as rownames the names of the list.</p>
  
  <p>like:</p>
  
  <pre><code>_____x  y  
  doc1 5  6  
  doc2 2 1  
  doc1 9 5  
  doc2 2 2   
  </code></pre>
  
  <p>I know you can change the rownames with the <code>row.names</code> function, but this does not work for multiple rows. I also tried to multiply the list, to the correct length of the data frame and then use the <code>row.names</code> function, but this didn't work aswell. Any idea how to fix this?  </p>