title: Dealing with readLines() function in R
body: <p>I'm experiencing a very hard time with R lately.</p>
  
  <p>I'm not an expert user but I'm trying to use R to read a plain text (<code>.txt</code>) file and capture each line of it. After that, I want to deal with those lines and make some breaks and changes in the text.</p>
  
  <p>Here is the code I'm using:</p>
  
  <pre><code>fileName &lt;- "C:/MyFolder/TEXT_TO_BE_PROCESSED.txt"
  con &lt;- file(fileName,open="r")
  line &lt;- readLines(con)
  close(con)
  </code></pre>
  
  <p>It reads the text and the line breaks perfectly. But I don't understand how the created object <code>line</code> works.</p>
  
  <p>The object <code>line</code> created with this code has the class: <code>character</code> and the length <code>[57]</code>.
  If I type <code>line[1]</code> it shows exactly the text of the first line. But if I type </p>
  
  <pre><code>length(line[1])
  </code></pre>
  
  <p>it returns me <code>[1]</code>.</p>
  
  <p>I would like to know how can I transform this string of <code>length == 1</code> that contains 518 in fact into a string of <code>length == 518</code>.</p>
  
  <p>Does anyone know what I'm doing wrong?</p>
  
  <p>I don't need to necessarily use the <code>readLines()</code> function. I've did some research and also found the function <code>scan()</code>, but I ended with the same situation of a immutable string of 518 characters but <code>length == 1</code>.</p>
  
  <p>Hope I've been clear enough about my doubt. Sorry for the bad English.</p>