[R] Keeping scientific format on assignment

Bjørn-Helge Mevik bhs2 at mevik.net
Thu May 11 09:20:00 CEST 2006


Joe Byers wrote:

> For example, the box.test object has a p-value of 2e-14 when I do
> a<-box.test.object$p-value;
> a;
> the value of a is 0 not 2e-14.

The _value_ is still 2e-14 (up to machine precision).

> How do I keep the precision and format of the p-value.

You can format p-values in different ways using format.pval(), which
returns a string with the formatted value.  E.g.,

> format.pval(2e-14)
[1] "2e-14"

-- 
Bjørn-Helge Mevik




More information about the R-help mailing list