title: Programmatically insert text, headers and lists with R markdown
body: <p>When using R markdown if one wants to add text using code there are some simple ways to do it. </p>
  
  <p>This is also true for tables, using the <code>kable</code> command is very easy.</p>
  
  <p>However, imagine you want to programmatically insert headers or lists to your report.</p>
  
  <pre><code>```{r, results='asis'}
  headers=list("We","are","your","friends")
  for (i in list_a){
      #add i as header
  }
  ```
  </code></pre>
  
  <p>and you want this to be the same as writing in your Rmd file:</p>
  
  <pre><code>#We
  #are
  #your
  #friends
  </code></pre>
  
  <p>Another example would be to automatically create headers instead of lists:</p>
  
  <pre><code>```{r, results='asis'}
  list_a=list("We","are","your","friends")
  for (i in list_a){
      #print i to a rmd list
  }
  ```
  </code></pre>
  
  <p>as before this should have the same result as writing:</p>
  
  <pre><code>*We
  *are
  *your
  *friends
  </code></pre>
  
  <p><strong>This is not only a formatting problem as the table of context for Rmd files is created dynamically according to these headers.</strong> </p>