From ggrothendieck at gmail.com  Tue Mar 20 17:44:51 2007
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Tue, 20 Mar 2007 12:44:51 -0400
Subject: [Rd] wishlist -- Fix for major format.pval limitation (PR#9574)
In-Reply-To: <20070320163656.2B81F5ABEB@slim.kubism.ku.dk>
References: <20070320163656.2B81F5ABEB@slim.kubism.ku.dk>
Message-ID: <971536df0703200944x62af2966yf11b9b3ab6af3d11@mail.gmail.com>

On 3/20/07, murdoch at stats.uwo.ca <murdoch at stats.uwo.ca> wrote:
> On 3/20/2007 11:19 AM, charles.dupont at vanderbilt.edu wrote:
> > Full_Name: Charles Dupont
> > Version: 2.4.1
> > OS: linux 2.6.18
> > Submission from: (NULL) (160.129.129.136)
> >
> >
> > 'format.pval' has a major limitation in its implementation. For example
> > suppose a person had a vector like 'a' and the error being ?0.001.
> >
> >     > a <- c(0.1, 0.3, 0.4, 0.5, 0.3, 0.0001)
> >     > format.pval(a, eps=0.01)
> >
> > If that person wants to have the 'format.pval' output with 2 digits always
> > showing (like passing nsmall=2 to 'format'). That output would look like
> > this.
> >
> >     [1] "0.10"   "0.30"   "0.40"   "0.50"   "0.30"   "<0.01"
> >
> > That output is currently impossible because format.pval can only
> > produce output like this.
> >
> >     [1] "0.1"    "0.3"    "0.4"    "0.5"    "0.3"    "<0.01"
> >
> >
> > ---------------------------------------------------------------
> > a <- c(0.1, 0.3, 0.4, 0.5, 0.3, 0.0001)
> > format.pval(a, eps=0.01)
>
> But there's a very easy workaround:
>
> format.pval(c(0.12, a), eps=0.01)[-1]
>
> gives you what you want (because the 0.12 forces two decimal place
> display on all values, and then the [-1] removes it).
>

Clever, but the problem would be that summary.lm, etc. call format.pval so the
user does not have a chance to do that.



[Rd] wishlist -- Fix for major format.pval limitation (PR#9574)
Gabor Grothendieck