title: R String Interpretation: why does "\040" get interpreted as " " and what other potential pitfalls could I come across in string interpretation?
body: <p>I was helping someone today regex some info out of a pdf file that we read in as a txt file.  Unfortunately the tm packages readPDF function was not working correctly at the time, though through a few modifications we were able to get it to work just fine.  While we were regexing out some of the fluff from the .txt file we found something that was surprising to most of us, namely that the string "\040" gets interpreted as a space, " ".</p>
  
  <pre><code>&gt; x &lt;- "\040"    
  &gt; x    
  &gt; [1] " "
  </code></pre>
  
  <p>This doesn't happen for other, similar character strings (i.e. "\n" or "\t") that you may expect this to happen for.</p>
  
  <pre><code>&gt; y &lt;- "\n"   
  &gt; y    
  &gt; [1] "\n"    
  &gt; z &lt;- "\t"    
  &gt; z    
  &gt;[1] "\t"
  </code></pre>
  
  <p>Why is this?  What other character strings are interpreted differently in R?</p>
  
  <p>EDIT:</p>
  
  <p>It seems after simple experimentation, any "\xxx" where x are digits yields a different result.  What is the value of this?</p>