title: Adding a space between two characters in a data frame in R
body: <p>I have a data frame where each cell are 2 character strings (ie: "AA" , "BC" , "CD")  where I am trying to put spaces between each of the two characters, and where NA values remain as is.  I can't seem to figure this out.  Any help????</p>
  
  <p>Here is an example data frame:</p>
  
  <pre><code> df &lt;- data.frame(col1=c("AB", "CD", "EF"), col2=c("AA", "BB", "CC"), col3=c("XX", "YY", NA))
  </code></pre>
  
  <p>And this is what the example data frame looks like:</p>
  
  <pre><code>   col1 col2 col3
  1   AB   AA   XX
  2   CD   BB   YY
  3   EF   CC &lt;NA&gt;
  </code></pre>
  
  <p>This is what i want my data frame to look like:</p>
  
  <pre><code>   col1  col2  col3
  1   A B   A A   X X
  2   C D   B B   Y Y
  3   E F   C C   &lt;NA&gt;
  </code></pre>
  
  <p>Thanks in advance!</p>