[R] extracting p-values in scientific notation

Erich Neuwirth erich.neuwirth at univie.ac.at
Mon Oct 3 12:08:38 CEST 2011


format.pval is documented and accessible from outside of base.
So you do not have to qualify it as base::format.pval

On 10/3/2011 11:24 AM, Liviu Andronic wrote:
> 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
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list