title: End of line character missing with capture.output in R
body: <p>In R, when I print/cat in a function, it is printed properly in stdout when the function is called. When I put the output in a variable via capture.output, the end-of-line character "\n" is missing.</p>
  
  <p><em>Here is simple R code example:</em></p>
  
  <pre><code>ff &lt;- function(){ print(-5:-1);cat("dummy line\n");print(1:5)}
  ff()
  </code></pre>
  
  <p>gives the output:</p>
  
  <pre><code>[1] -5 -4 -3 -2 -1
  dummy line
  [1] 1 2 3 4 5
  </code></pre>
  
  <p>and the following code gives output in single line.</p>
  
  <pre><code>ff_out&lt;-capture.output(ff())
  ff_out
  </code></pre>
  
  <p>gives the same output in one line (i.e., with "\n" missing)</p>
  
  <p>I must be missing something very simple. Please help me resolve this to get the same output as shown above. </p>