<> または sink() で抑制することができない無関係な出力が .tex ファイルに表示されます。特に、不要な行は ..{Schunk} などで囲まれていません。
これは、DEoptim または rjags のいずれかを使用しているときに発生しますが、これらの関数に限定されているわけではありません。
.Rnw ファイルの例:
\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}
私が望む 結果は、出力が抑制された場合、またはコード チャンクが .Rnw ファイルから削除された場合に生成される tex ファイルです。
\documentclass[a4paper, 12]{article}
\usepackage{Sweave}
\begin{document}
\end{document}
ただし、結果の .tex ファイルには関数からの出力があります。
\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}
出力は \begin{Schunk} \end{Schunk} で囲まれていないため、$ 記号が LaTeX を混乱させ、コンパイルできないことに注意してください。