[R] Scientific notation?

Martin Maechler maechler at stat.math.ethz.ch
Wed Jan 17 18:30:16 CET 2001


>>>>> "Yves" == Yves Gauvreau <cyg at sympatico.ca> writes:

    Yves> Hi, Would there be a function and/or some options to force R to
    Yves> write a value of say 1.0e-4 as "0.0001"? More specifically I want
    Yves> to use R to write ASCII file(s) for other programs to read and
    Yves> some of these programs don't know how to deal numbers in
    Yves> scientific notation or have a different convention.

Probably variations of these will solve your problem :

> formatC(pi * 10^(-7:-3), format = "f", digits = 10)
[1] "0.0000003142" "0.0000031416" "0.0000314159" "0.0003141593" "0.0031415927"

> formatC(pi * 10^(-7:-3), format = "fg", digits = 10)
[1] "0.0000003141592654" "0.000003141592654"  "0.00003141592654"  
[4] "0.0003141592654"    "0.003141592654"    


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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