Bug 9574 - wishlist -- Fix for major format.pval limitation
wishlist -- Fix for major format.pval limitation
Status: CLOSED FIXED
Product: R
Classification: Unclassified
Component: Wishlist
old
All Linux
: P5 normal
Assigned To: Jitterbug compatibility account
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-03-20 20:18 UTC by Jitterbug compatibility account
Modified: 2010-06-14 07:22 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jitterbug compatibility account 2007-03-20 20:18:36 UTC
From: charles.dupont@vanderbilt.edu
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)

Comment 1 Jitterbug compatibility account 2007-03-20 21:36:37 UTC
From: Duncan Murdoch <murdoch@stats.uwo.ca>
On 3/20/2007 11:19 AM, charles.dupont@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).

Duncan Murdoch

Comment 2 Jitterbug compatibility account 2007-03-29 17:49:27 UTC
Audit (from Jitterbug):
Thu Mar 29 12:49:27 2007	ripley	moved from incoming to wishlist
Comment 3 Brian Ripley 2010-06-14 07:22:01 UTC
added ... in 2.12.0