title: generate markdown comments within for loop
body: <p>I am trying to generate an HTML report, using knitr, based on an R script that has for loops.  I want to generate markdown comments from the comments within the for loop, but I am not sure if it's possible.</p>
  
  <p>Here is simple example, this is in test.R:</p>
  
  <pre><code>for (i in 1:5) {
      ## This is a heading for `i`
      #' This is a comment for `i`
      print(i)    
  }
  </code></pre>
  
  <p>Then i use spin to generate a Rmd file:
  spin('test.R')</p>
  
  <p>However, the Rmd file looks like the following.</p>
  
  <pre><code>```{r }
  for (i in 1:5) {
      ## This is a heading for `i`
      #' This is a comment for `i`
      print(i)    
  }
  ```
  </code></pre>
  
  <p>The markdown comments within the R chunk are not compiled into HTML. Is it possible?</p>
  
  <p>Thanks,
  Peter</p>