I am getting extraneous output in my .tex file that I can not suppress with <> or sink(). Notably, the unwanted lines are not enclosed by ..{Schunk} or similar.
This occurs for me when I use either DEoptim or rjags, although this is likely not limited to these functions.
example .Rnw file:
\documentclass[a4paper, 12]{article}
begin{document}
<<echo=FALSE>>=
require(DEoptim)
Rosenbrock <- function(x){ #example from DEoptim authors
x1 <- x[1]
x2 <- x[2]
100 * (x2 - x1 * x1)^2 + (1 - x1)^2
}
lower <- c(-10,-10)
upper <- -lower
set.seed(1234)
DEoptim(Rosenbrock, lower, upper)
@
\end{document}
What I want to happen The result that I would like is the tex file that would be produced if the output were suppressed, or equivalently, if the code chunk were removed from the .Rnw file:
\documentclass[a4paper, 12]{article}
\usepackage{Sweave}
\begin{document}
\end{document}
What Happens However, the resulting .tex file has output from the function:
\documentclass[a4paper, 12]{article}
\usepackage{Sweave}
\begin{document}
Iteration: 1 bestvalit: 132.371451 bestmemit: -1.851683 4.543355
Iteration: 2 bestvalit: 8.620563 bestmemit: -1.854371 3.369908
....few hundred lines of DEoptim output ....
$member$storepop
list()
attr(,"class")
[1] "DEoptim"
\end{document}
Note that the output is not enclosed by \begin{Schunk} \end{Schunk}, so the $ signs confuse LaTeX and it won't compile.
Have you tried
<<echo=FALSE, results=hide>>
?