title: knitr: Is there any way for forloop conditions to include Sexpr?
body: <p>I'm using the knitr package in R to try and convert a dataframe into a report.
  The issue is that there is a lot of variability in the input data. The aim is to print one line of text (pulled from a dataframe, followed by a graph, also from a dataframe)</p>
  
  <p>The following code is a pared down version of the same. It doesn't output aby PDF file.</p>
  
  <pre><code>\documentclass{report}
  \usepackage{forloop}
  \newcounter{tmp}
  
  \begin{document}
  \newcommand{\Brep}{$\Sexpr{A}$}
  
  \forloop{tmp}{1}{\value{tmp} &lt; \Brep} {\Brep}
  
  \end{document}
  </code></pre>
  
  <p>On checking logs, and removing portions, I've narrowed it down to knitr/latex not being able to evaluate the \FBrep portion in the forloop's condition.</p>
  
  <p>Is there any way to get around this?
  Also, in the next step, I'll need to use includegraphics in a similar manner, as follows</p>
  
  <pre><code>\includegraphics{\Brep.PNG}
  </code></pre>
  
  <p>Sorry if this is RTFM material. I'm really new, and I did look around a lot.
  Thanks</p>