I am trying to create a latex simulation report with knitR. My R code has a cycle for products and generates a graph for each product. I want to include a section title for each iteration of the loop. I used resuls = 'asis' and tried to print the section header in a loop, as in the code snippet below:
<<looptest, echo=FALSE, results='asis', warning=FALSE>>= for (product in c("prod 1","prod 2")){ print(paste("\\section{",product,"}", sep="")) } @
The problem is that I get this when I exit latex:
[1] "\\section{prod 1}" [1] "\\section{prod 2}"
source share