title: Can knitr dynamically output narrative text based on R code results in each chunk?
body: <p>I'm thinking about developing a .rmd file that can dynamically write some chunks of narratives in the output file (.html,.pdf,...) based on the preceding R result. To put it simple below is how I want it works:</p>
  
  <pre><code>```{r,echo=F,include=FALSE}
  x=1;
  
  ```
  ##if x=1 then output text below
  text1
  
  ##if x=2 then output text below
  text2
  
  .....
  </code></pre>