title: Setting *only* column names in Rcpp
body: <p>I want to set a matrix's column names only using Rcpp, but leave the row names unchanged.  So far as I can tell, the <code>dimnames</code> attribute only sets both.  For example:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/5709940/r-extension-in-c-setting-matrix-row-column-names/5711326#5711326">R extension in C, setting matrix row/column names</a></li>
  <li><a href="http://dirk.eddelbuettel.com/code/rcpp/Rcpp-FAQ.pdf" rel="noreferrer">http://dirk.eddelbuettel.com/code/rcpp/Rcpp-FAQ.pdf</a> (p.13)</li>
  </ul>
  
  <p>Here's a minimal example of what I want to do, but just in Rcpp instead of R:</p>
  
  <pre><code>my.mat &lt;- diag(3)
  colnames( my.mat ) &lt;- c( "A", "B", "C")
  my.mat
       A B C
  [1,] 1 0 0
  [2,] 0 1 0
  [3,] 0 0 1
  </code></pre>
  
  <p>Is there a way to do this?</p>