# Looping a code-chunk in LaTeX

I want to generate a report for three types of analysis I am performing. But each time when I perform the analysis it can happen that one or more than one type of analysis occur. I want to put condition in the report that will run the part of report according to the type of analysis performed. For each analysis I need to repeat the chunk say n times. I am stuck at writing a for loop for the code chunk. 'a' is a vector eg code:

\myboolean\Sexpr{myboolean}
for(i in 1:n)
\section{Frequency Analysis}
<<for-loop>>=
print(a[i])
@

-
I'm not quite sure what you are trying to accomplish, but have a look at either tikz/pgf or luatex, both have for-loops. –  Psirus Jul 19 '12 at 17:49
See https://gist.github.com/3145751 for an example with knitr. You cannot insert LaTeX into R code directly (it is not like PHP), but you can knit a child document for n times with different values of i.
could you paste the log somewhere like pastebin? pastebin.com I cannot really read the log here. BTW, are you using the latest version of knitr? –  Yihui Jul 20 '12 at 21:59