Skip to content
Prev 244082 / 398506 Next

getting the exact p value

Hi,

It depends on the function used to calculate it---each has their own
way of extracting particular values.  Here's an example for t.test:

x <- rnorm(10, 100, .1); y <- x - 100
t.test(x, y)$p.value

You could find this yourself by looking at the documentation for t.test()

?t.test

The heading "Value" shows what the function returns (though not
necessarily all printed).  Typically, you can access any of those by
$theirname.  In this case you see p.value, so you can get the p-value
by: t.test()$p.value.  Equivalently (and more useful for reference)

## save the results of t.test()
txy <- t.test(x, y)
txy$p.value


HTH,

Josh
On Mon, Dec 6, 2010 at 11:03 AM, kayj <kjaja27 at yahoo.com> wrote: