I have a Rnw file like below. I'd like to create multiple pdf files by changing data inside the Rnw file dynamically.
\begin{document}
\newpage
<<code,comment="",echo=FALSE,include=FALSE>>=
x=source('myR.R')
y=print.xtable(xtable((someDF)))
z<-someDF$col1
@
\title{My Title}
\textsc{Data: \Sexpr{z}}
\Sexpr{y}
\end{document}
On the first run, I need the pdf file to be col1.pdf
and the value of z be z<-someDF$col1
. On the second run file created should be col2.pdf
and value of z updated as z<-someDF$col2
. The number of runs shall be decided on the run, and stored in a variable say run
Can something like this can be done?