[R] Sweave for inclusion of p value in a sentence of a LaTeX document

julia.jacobson at arcor.de julia.jacobson at arcor.de
Sat Aug 7 22:02:07 CEST 2010


Dear R Users,

I would like to include the p value in the results returned by the t.test function in a sentence of a LaTeX document. For this purpose, I use the following code (file.Rnw):

\documentclass{article}
\begin{document}
The p value for my data was 
<<echo=FALSE>>=
x<-cbind(1,2,3)
y<-cbind(3,4,5)
t.test(x,y)
@
which is not significant.
\end{document}

I use "R CMD Sweave file.Rnw" and "pdflatex file.tex" to create a PDF document of it.
However, the all details of the t-test are included in my document and form a new paragraph in another format than the rest of the original sentence.
The sentence should look like this: "The p value for my data was 0.2879 which was not significant."
Thanks in advance.

Julia

Wassertemperaturen in Deutschland
Sommer, Sonne, Strand - wer braucht Abkühlung? Die aktuellen Wassertemperaturen und Windgeschwindigkeiten für Deutschlands Badeseen gibt´s auf arcor.de.



More information about the R-help mailing list