-----Message d'origine-----
De : Martin Maechler [mailto:maechler at stat.math.ethz.ch]
Envoye : Wednesday, January 17, 2001 12:30 PM
A : Yves Gauvreau
Cc : R-help at lists. R-project. org
Objet : Re: [R] Scientific notation?
"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"