[Rd] fix for a major format.pval limitation

Charles Dupont charles.dupont at vanderbilt.edu
Tue Feb 20 21:47:18 CET 2007

'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.001)

The person wants to have the 'format.pval' output with 2 digits always 
showing like this

    [1] "0.10"   "0.30"   "0.40"   "0.50"   "0.30"   "<0.001"

How ever format.pval can only display this

    [1] "0.1"    "0.3"    "0.4"    "0.5"    "0.3"    "<0.001"

If this was the 'format' function this could be corrected by setting the 
'nsmall' argument to 2.  But 'format.pval' has no ability to pass 
arguments to format.

I think that the best solution would be to give 'format.pval' a '...' 
argument that would get passed to all the 'format' function calls in 

I have attached a patch that does this.  This patch is against svn 
r-release-branch and will also apply to r-devel.

Charles Dupont
Charles Dupont	Computer System Analyst		School of Medicine
		Department of Biostatistics	Vanderbilt University
-------------- next part --------------
A non-text attachment was scrubbed...
Name: format.pval.patch
Type: text/x-diff
Size: 2008 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-devel/attachments/20070220/4cf183f0/attachment.bin 

More information about the R-devel mailing list