[R] extracting p-values in scientific notation

Liviu Andronic landronimirc at gmail.com
Mon Oct 3 11:24:05 CEST 2011


Thanks all for your pointers. The following does trick:
> base::format.pval(x$p.value)  ##Hmisc also has such a function
[1] "<2e-16"


On Mon, Oct 3, 2011 at 10:25 AM, Rolf Turner <rolf.turner at xtra.co.nz> wrote:
> Isn't it true that 0 < 2.2e-16?
>

Yes, but it doesn't mean that the p-value actually hits absolute zero.
And cor.test, as Ted noticed, returns
> identical(x$p.value, 0)
[1] TRUE

Not that this makes a great practical difference in my case, but I
would still prefer to print "<2e-16" in my Sweave document.

Regards
Liviu



More information about the R-help mailing list