[Rd] Patch for format.pval limitation in format.R

Charles Dupont charles.dupont at vanderbilt.edu
Fri Mar 2 22:49:48 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
'format.pval'.

I have attached a patch that does this.  This patch is against svn
r-release-branch, but it also works with 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: 2009 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-devel/attachments/20070302/04e94bd0/attachment.bin 


More information about the R-devel mailing list