title: Add a name to the column header for an existing matrix in r
body: <p>I have a headered matrix and I would like to add the word "genes" to the first position in the column header for the matrix, basically attaching that word to the beginning of the column header.  </p>
  
  <p>Here is what I have so far:
  I input a matrix into R, </p>
  
  <pre><code>matrix_a &lt;- read.table(args[1], sep='\t', header=T, row.names=1);
  </code></pre>
  
  <p>and generate a heatmap from that matrix, using heatmap.2.  I then extract the data for the corresponding heatmap using the carpet variable.</p>
  
  <p>Here is the code used to generate the heatmap:</p>
  
  <pre><code>result &lt;- heatmap.2(mtscaled, Rowv=T, scale='none', dendrogram="row", symm = T, col=bluered(16), breaks = my.breaks)
  </code></pre>
  
  <p>Here I am extracting the values for the clustered matrix, after passing the original matrix through heatmap.2: </p>
  
  <pre><code>new_matrix &lt;- result$carpet
  old_name &lt;- colnames(new_matrix)
  </code></pre>
  
  <p>Here I am trying to attach the name "genes" to the column name</p>
  
  <pre><code>old_name &lt;- cat("genes",old_name)
  colnames(new_matrix) &lt;- old_name;
  write.table(new_matrix, file="data_result3.txt",sep = " \t",col.names = T, row.names = T);
  </code></pre>
  
  <p>When I try to attach "genes" to the header using:</p>
  
  <pre><code>old_name &lt;- cat("genes",old_name)
  </code></pre>
  
  <p>The headers are printed out to the screen properly, 
  but when I examine the result file the vector number is printed:</p>
  
  <p>"V1"    "V2"    "V3"    "V4"    "V5"    "V6"  </p>
  
  <p>Instead I would like the result to look like:</p>
  
  <p>genes   Pacs-11 Pacs-2  PC06E7.3    PC49C3.3    Pceh-60 PF52C6.12</p>
  
  <p>In this way genes comes before the rest of the matrix header.</p>
  
  <p>Here is a link to my dataset:
  <a href="http://pastebin.com/xaXbPpFM" rel="nofollow">Full Dataset</a></p>
  
  <p>Here is the dataSet after running <code>dput(head(new_matrix))</code>
  <a href="http://pastebin.com/gN8vy6Hu" rel="nofollow">output of dput</a></p>