title: R: reading in a text file with the paste function
body: <p>I think this should have a simple answer but I haven't found it yet. Basically, I want to make a function that calls and reads in a text file. Here's what I have (I'm writing this in ui.R file of a Shiny function, but I don't think that's part of the problem):</p>
  
  <pre><code>popovers &lt;- function(pop_name){
    fileName &lt;- paste0("\'",pop_name,".txt\'")
    js &lt;- readChar(fileName, file.info(fileName)$size))
    js
  }
  </code></pre>
  
  <p>Right now, I can't even concatenate <code>fileName</code> since I get the error "cannot coerce type 'closure' to vector of type 'character'" from the <code>paste0</code> function. Any ideas on how to fix this? Is this the correct method of reading in various .txt files? </p>