Skip to content
Prev 23946 / 63424 Next

fix for a major format.pval limitation

'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 
'format.pval'.

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