title: write.table is not outputting a header for row names
body: <p>I try to write out a matrix to csv while retaining rownames (c.f. <a href="https://stackoverflow.com/questions/6844166/export-matrix-in-r">Export matrix in r</a>).</p>
  
  <p>However when I do it using write.table() all the columns get shifted to the left (so the first data column header appears above the rownames column).</p>
  
  <pre><code>"PC1","PC2","PC3","PC4"
  "Murder",0.0417043206282872,-0.04482165626967,0.0798906594208106,-0.994921731246978
  "Assault",0.995221281426497,-0.0587600278572231,-0.0675697350838042,0.03893829763516
  "UrbanPop",0.0463357461197111,0.976857479909889,-0.200546287353865,-0.0581691430589317
  "Rape",0.0751555005855469,0.200718066450337,0.974080592182492,0.0723250196376096
  </code></pre>
  
  <p>I tried the following (to manually add an extra column):</p>
  
  <pre><code>merged.pca &lt;- prcomp(USArrests)
  
  write.table(merged.pca$rotation, file = "rotation.csv", sep = ",", col.names = c("rowname",colnames(merged.pca$rotation)))
  </code></pre>
  
  <p>Unfortunately this fails with:</p>
  
  <pre><code>Error in write.table(merged.pca$rotation, file = "rotation.csv", sep = ",",  : 
    invalid 'col.names' specification
  </code></pre>
  
  <p>TBH I have no clue what this error means. Is it something about the argument being a list and not a vector?</p>