title: How to include all output from an R Markdown chunk in one block?
body: <p>When I evaluate a code chunk using knitr in RMarkdown, there are blank spaces separating code from output.</p>
  
  <p>For example, if I evaluate the following chunk:</p>
  
  <pre><code># I want to remove the white separations from the following chunk output
  
  1+1
  
  2+4
  </code></pre>
  
  <p>Then I receive the following output in my document (notice the blank white lines)</p>
  
  <p><a href="https://i.stack.imgur.com/yb4V2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yb4V2.png" alt="enter image description here"></a></p>
  
  <p>What I really want is this, where both the code and the output is contained in one formatted code block.</p>
  
  <pre><code># I want to remove the white separations from the following chunk output
  
  1+1
  
  ## [1] 2
  
  2+4
  
  ## [1] 6
  </code></pre>
  
  <p>How can I get the chunk output to not have the blank white spaces?</p>
  
  <p>Note: I do <em>not</em> want all of the output to come after the code as would happen if I included the chunk option <code>results = "hold"</code>. I need the output from each line to come right after the code that generated the line.</p>