Skip to content
Prev 32563 / 398532 Next

write staff out

On 05/27/03 16:01, ZRG (Zeren Gao) wrote:
The following function prints a t test result in LaTeX format, in
a way that elicits the fewest complaints from reviewers for
psychology journals.  This is for a one-sample test.

ttest  <- function (x)
{
tc <- t.test(x)
print(paste("($t_{",tc[[2]],"}=",formatC(tc[[1]],format="f",digits=2),
            "$, $p=",formatC(tc[[3]],format="f"),"$)",sep=""),quote=FALSE)
print(tc$estimate)
}

I don't know how you want to represent degrees of freedom in
"regular text," but you can probably figure out how to modify this.