[R] Bug or new concept in formatC?
BXC (Bendix Carstensen)
bxc at novonordisk.com
Fri Oct 26 13:25:57 CEST 2001
As a sequel to my previous mail on cut, formatC does not produce
what I have been taught is significant digits:
> x <- c(1.0793,1.0796, 11.0954, 11.0736 )
> formatC(x,digits=3,format="g")
[1] "1.08" "1.08" "11.1" "11.1"
(3,3,3,3) significant digits OK
> formatC(x,digits=3,format="f")
[1] "1.079" "1.080" "11.095" "11.074"
(3,3,3,3) digits after point, [(4,4,5,5) significant] OK
> formatC(x,digits=4,format="g")
[1] "1.079" " 1.08" " 11.1" "11.07"
(4,3,3,4) significant digits --- not OK (?)
Apparently formatC thinks that trailing 0s cannot count as significant.
Is this a bug or another concept of significant digits?
Bendix Carstensen
----------------------
Bendix Carstensen
Senior Statistician
Steno Diabetes Centre
Niels Steensens Vej 2
DK-2820 Gentofte
Denmark
tel: +45 44 43 87 38
mob: +45 28 25 87 38
fax: +45 44 43 73 13
bxc at novonordisk.com
www.biostat.ku.dk/~bxc
----------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list