Knitr HTML Loop - Some HTML output, some R output -


I should loop through the list and print some part of it in HTML and some code as well To be more accurate: I want to produce the same product that is causing it.

  & lt; H2 & gt; 1 is a large number & lt; / H2 & gt; & Lt ;! - begin.rcode echo = FALSE print (rnorm (5, mean = 1)) end.rcode - & gt; & Lt; H2 & gt; 2 is a large number & lt; / H2 & gt; & Lt ;! - begin.rcode echo = FALSE print (rnorm (5, mean = 2)) end.rcode - & gt; ... & lt; H2 & gt; X is a large number & lt; / H2 & gt;  

I managed to print HTML but the results were printed directly in HTML, with the following chuck:

  ", i, "is a large number & lt; / H2> ") print (Rnorm (5, mean = i)) end.rcode ->  

All suggestions will be very happy about.

PS: The reason for this is that I want to format, then it produces very good output.

Hello again another solution using Floo0.RHML files first, mainfile Rhtml , makes the second call as much as you want. In the stepfile.rhtml you can add sections as you want, you just need to compile the code to mainfile.rhtml .

  ## Main file Rhtml & lt ;! - begin.rcode echo = false j & lt; - 10 end.rcode - & gt; & Lt ;! - Include begin.rcode = FALSE & lt; - For NULL (i in 1: J) {Out & lt; - c (outside, knit_child ('stepfile.rhtml'))} end.rcode - & gt; & Lt ;! - rinline paste (outside, collapse = '\ n') - & gt; ## stepfile.rhtml & lt ;! - begin.rcode echo = FALSE, result = 'asis' cat ("<"> h2> i, "is a large number ") end.rcode -> & Lt ;! - begin.rcode echo = FALSE print (rnorm (5, mean = i) end.rcode - & gt;  

I took this idea from


Comments