[R] Latex + R + sweave

Liviu Andronic landronimirc at gmail.com
Mon Sep 12 10:34:26 CEST 2011


On Mon, Sep 12, 2011 at 9:21 AM, Twaha Mlwilo <uddessy2006 at hotmail.com> wrote:
>
> Hello all,
> Good day,
> I have problem on how to remove the source code from the pdf output.Here I mean this.
>  code in sweave Rnw files
>
>  <<>>=
>  x<-c(1,2,3,4,5,6)
> x
>  mean(x)
> sd(x)
> @
> then would like it appear as
> mean = 3.5
> sd=1.3
> x=1,2,3,4,5,6
>
Try this:
<<echo=F>>=
  x<-c(1,2,3,4,5,6)
 x
  mean(x)
 sd(x)
 @

See ?RweaveLatex. Also, try
"mean = \Sexpr{mean(x)}"

in your document. You could also play with ?paste in the code chunk,
or with generating a matrix with appropriate row names, and printing
that.

Regards
Liviu



More information about the R-help mailing list