R-beta: quantile
Martyn Plummer
plummer@iarc.fr
Fri, 27 Feb 1998 13:44:51 +0100
Martin Maechler wrote:
>
> [diverted from R-help to R-devel]
>
> >>>>> "PD" == Peter Dalgaard BSA <p.dalgaard@biostat.ku.dk> writes:
> PD> Maybe we should put in an extra argument for controlling the precision
> PD> of the rounding?
>
> Hmm, I think we agree that we should improve that 'names(gs)..' line.
>
> However, the first step should be to use a much better default than
> round(100 * probs)
> If the default is ``smart enough'',
> maybe we don't really need a new argument
> [Can still have one for the ones who really want to fine-tune the names..]
>
> -------------
>
> Some untested proposals for replacement of
> round(100 * probs)
>
> 1) formatC(100*probs, dig=3, format='f')
> 2) formatC(100*probs, dig= max(3, .Options$digits - 3), format='f')
> 3) signif(100*probs, max(3, .Options$digits - 3))
>
> or then replace "max(3, .Options$digits - 3)"
> by the new argument 'digits.names'
> and have that one default to
> digits.names = max(3, .Options$digits - 3)
What about just using format(100*probs)?
R> foo <- function(probs) paste(format(100 * probs), "%", sep="")
R> foo(c(0.02,0.25,0.50))
[1] " 2%" "25%" "50%"
R> foo(c(0.025,0.25,0.50))
[1] " 2.5%" "25.0%" "50.0%"
R> foo(c(0.0125,0.25,0.50))
[1] " 1.25%" "25.00%" "50.00%"
I am probably missing something but this seems to be "smart" enough.
Martyn
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._