[R] Sweave for inclusion of p value in a sentence of a LaTeX document
Matthieu Dubois
matthdub at gmail.com
Sun Aug 8 08:16:09 CEST 2010
Dear Julia,
my way to do that is to attribute the t.test to an object,
and then refer to its p.value with the function
\Sexpr
e.g.
\documentclass{article}
\usepackage{Sweave}
\begin{document}
<<echo=FALSE>>=
x<-cbind(1,2,3)
y<-cbind(3,4,5)
t <- t.test(x,y)
@
The p value for my data was \Sexpr{ round(t$p.value, 3) }
which is not significant.
\end{document}
Best,
Matthieu
Matthieu Dubois
Post-doctoral researcher
Department of Psychology and Neural Science, NYU
More information about the R-help
mailing list