title: Create a simple report with text strings and plots using loop in r
body: <p>I'm trying to find a way to loop through rows of a data frame to produce a report (preferably in PDF) that includes strings the length of a paragraph or longer, plots, and data values for each day of the year. I've exported PDFs of just plots in a loop before, but I can't find a solution to include text of any considerable length. </p>
  
  <p>Imagine I have a data frame like this: </p>
  
  <pre><code>Date &lt;- c("01/01/2014", "01/02/2014", "01/03/2014")
  TextString &lt;- c("imagine this is a paragraph or longer 1", "imagine this is a paragraph or longer 2", "imagine this is a paragraph or longer 3")
  TableData1 &lt;- c(10000, 9000, 8000)
  TableData2 &lt;- c(6, 5, 4)
  PlotData3 &lt;- c(22, 11, 21)
  PlotData4 &lt;- c(6, 7, 8)
  PlotData5 &lt;- c(21, 17, 14)
  Report &lt;- data.frame(Date, TextString, TableData1, TableData2, PlotData3, PlotData4, PlotData5)
  </code></pre>
  
  <p>And I would like the report to be structured something like this in the PDF:</p>
  
  <pre><code>01/01/2014
  imagine this is a paragraph or longer 1
  "TableData1:" 10000 
  "TableData2:" 6 
  *plot* pie(c(Report$PlotData3[1], Report$PlotData4[1], Report$PlotData5[1]))
  
  01/02/2014
  imagine this is a paragraph or longer 2
  "TableData1:" 9000 
  "TableData2:" 5 
  *plot* pie(c(Report$PlotData3[2], Report$PlotData4[2], Report$PlotData5[2]))  
  
  01/03/2014
  imagine this is a paragraph or longer 3
  "TableData1:" 8000 
  "TableData2:" 4 
  *plot* pie(c(Report$PlotData3[3], Report$PlotData4[3], Report$PlotData5[3])) 
  </code></pre>
  
  <p>Can anyone point me in the right direction? I looked at some tutorials for knitr since it seems applicable, but I wasn't sure it would loop through data in this manner.</p>