title: prevent knitr/Rmarkdown from interleaving chunk output with code
body: <p>When I use knitr to build an HTML document out of the following code:</p>
  
  <pre><code>Chunk Output
  ========================================================
  
  Outside a chunk.
  
  ```{r chunk1, results='asis'}
  
  cat('Inside a chunk\n\n')
  
  for (i in 1:3) {
      cat('* Inside loop #', i, '\n')
  }
  
  cat('Outside a loop, but still inside the first chunk')
  ```
  
  Between chunks.
  
  ```{r chunk2, results='asis'}
  
  cat('Inside second chunk')
  
  ```
  </code></pre>
  
  <p><a href="http://rpubs.com/HarlanH/chunktest">I get output</a> where the code in <code>chunk1</code> is interleaved with the output of the <code>cat</code> statements. Interestingly, the output within the <code>for</code> loop is output as a single block.</p>
  
  <p>I would prefer to have all of the <em>code</em> from <code>chunk1</code> to appear first, followed by all of the <em>output</em> from <code>chunk1</code>. Is there a way to ask Rmarkdown/knitr to avoid the more granular interweaving that it's currently doing? </p>