Hi, Would there be a function and/or some options to force R to write a value of say 1.0e-4 as "0.0001"? More specifically I want to use R to write ASCII file(s) for other programs to read and some of these programs don't know how to deal numbers in scientific notation or have a different convention. Thanks in advance. Yves Gauvreau B.E.F.P. Universit? du Qu?bec ? Montr?al cyg at sympatico.ca platform i386-pc-mingw32 arch x86 os Win32 system x86, Win32 status major 1 minor 2.0 year 2000 month 12 day 15 language R -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Scientific notation?
3 messages · Martin Maechler, Yves Gauvreau
"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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Just what I was looking for. Many thanks Yves Gauvreau B.E.F.P. Universite du Quebec a Montreal cyg at sympatico.ca
-----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"
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._