title: R colnames: A few character variable name changed to number
body: <p>I have a data frame called VarChange containing 1005 variables such as:</p>
  
  <pre><code>   row.name   SamplingEvent  Year  Zenaida_macroura  . . . 1005 variables
  1  12367      S41            2005  0
  2  12369      S42            2005  X
  3  12370      S43            2005  4
  4  OldSppName SamplingEvent  Year  Zenaida_macroura
  5  NewSppName SampEvent      Year  Zenamacr
  </code></pre>
  
  <p>My goal is to change the column names of the data frame to the row called "NewSppName" (a maximum 8 letters code equivalent of the present variable name).  This is needed to in order to not loose track of the various variables in ArcMap (which truncates all variables names to 8 characters).</p>
  
  <p>Every thing looks good (i.e. R outputs the appropriate NewSppNames) when I ask for:</p>
  
  <pre><code>Var['NewSppName',]
  </code></pre>
  
  <p>But when I use:</p>
  
  <pre><code>colnames(VarChange) &lt;- VarChange['NewSppName', ]
  </code></pre>
  
  <p>or </p>
  
  <pre><code>colnames(VarChange) &lt;- as.character(VarChange["NewSppName",])
  </code></pre>
  
  <p>I get the following output:</p>
  
  <pre><code>   row.names  7              Year  8            . . . 1005 variables
  1  12367      S41            2005  0
  2  12369      S42            2005  X
  3  12370      S43            2005  4
  4  OldSppName SamplingEvent  Year  Zenaida_macroura
  5  NewSppName SampEvent      Year  Zenamacr
  </code></pre>
  
  <p>95% of the variables do change name to the value in NewSppName but a dozen or so changes to numbers instead of the character name present in NewSppName.  </p>
  
  <p>Any reason why?  Any solution to this?</p>