[R] R number output format

jim holtman jholtman at gmail.com
Sun Sep 10 19:27:55 CEST 2006


?formatC

> formatC(.000000012, format='fg')
[1] "0.000000012"
>


also

?sprintf

> sprintf("%.10f", 0.0000000012)
[1] "0.0000000012"
>


On 9/10/06, Philip He <hydinghua at gmail.com> wrote:
> I'd like to save the number 0.0000012 to a file just as it appears, but when
> I dput(0.0000012, "t.txt"), I got 1.2e-06, NOT 0.0000012.
> Anybody knows how I can do this?
>
> > 0.0000012
> [1] 1.2e-06
>
> > as.character(0.0000012)
> [1] "1.2e-06"
>
> > dput(0.0000012, "t.txt")
>
>
> Thanks.
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list