title: Import text file as single character string
body: <p>How do you import a plain text file as single character string in R? I think that this will probably have a very simple answer but when I tried this today I found that I couldn't find a function to do this.</p>
  
  <p>For example, suppose I have a file <code>foo.txt</code> with something I want to textmine.</p>
  
  <p>I tried it with:</p>
  
  <pre><code>scan("foo.txt", what="character", sep=NULL)
  </code></pre>
  
  <p>but this still returned a vector. I got it working somewhat with:</p>
  
  <pre><code>paste(scan("foo.txt", what="character", sep=" "),collapse=" ")
  </code></pre>
  
  <p>but that is quite an ugly solution which is probably unstable too.</p>