I have a question about mixing LaTeX and R code in loops and functions in 
Sweave. Here's my problem:

I want to do something like this:

<<>>=

# some R code for a loop
for(i in 1:10) {

@

My LaTex code here would describe what I do in the loop. For instance, in this 
loop print out the numbers one through 10. Maybe I could even have
Multiple sections in between the loop. For instance,
\section{Part of 1 of the Loop}

<<>>=
                cat(paste("Number",i))
}
@

The problem is that Sweave evaluates the first chunk of code and throws an 
error because I haven't closed the loop. A similar problem happens when I want 
to have LaTeX code intermixed with a function. So how do I mix LaTex code with 
R chunks that alone may throw errors, but together with another chunk does not. 
Thanks in advance for your help! I am new to R and this is my first post on 
this list.


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to