I am working on Sweave now, when I want to use R code to describe one variable in the latex table.
It turns out that Sweave cannot read these R codes, the output is not the variable, instead, the output is the text form of all the c开发者_开发问答ode I write
You may want \Sexpr{R expression}
; for example, this Sweave snippet
<<echo=FALSE>>=
z <- exp(pi)
@
\begin{tabular}{cc}
a & \Sexpr{z} \\
b & \Sexpr{round(z,3)} \\
\end{tabular}
becomes this when Sweaved (Swoven?)
\begin{tabular}{cc}
a & 23.1406926327793 \\
b & 23.141 \\
\end{tabular}
精彩评论