I want to loop through a list and and print some part of it in HTML and some as Code. So be more precise: I want to produce the same output this is creating
<h2> 1 is a great number </h2>
<!--begin.rcode echo=FALSE print(rnorm(5,mean=1)) end.rcode-->
<h2> 2 is a great number </h2>
<!--begin.rcode echo=FALSE print(rnorm(5,mean=2)) end.rcode-->
...
<h2> x is a great number </h2>
I managed to print the 's to HTML but the results are printed directly in HTML as well, with the following Chunk:
<!--begin.rcode, echo=FALSE, results = 'asis'
for (i in list(1,2)){
cat("<h2>", i, "is a great number</h2>")
print(rnorm(5,mean=i))
}
end.rcode-->
Would be very happy about all suggestions.
P.S.: The reason why I want to have the formatting is that knirtBootstrap, then produces a very nice Output.
is a great number
` (using inline evaluation). – Brian Diggs Mar 04 '14 at 02:15