Re: [R] Keeping scientific format on assignment

From: Bjørn-Helge Mevik <bhs2_at_mevik.net>
Date: Thu 11 May 2006 - 17:20:00 EST

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

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu May 11 17:28:41 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 11 May 2006 - 18:10:04 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.