Re: [R] R number output format

From: jim holtman <jholtman_at_gmail.com>
Date: Sun 10 Sep 2006 - 17:27:55 GMT

?formatC

> formatC(.000000012, format='fg')

[1] "0.000000012"
>

also

?sprintf

> sprintf("%.10f", 0.0000000012)

[1] "0.0000000012"
>

On 9/10/06, Philip He <hydinghua@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@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?

______________________________________________
R-help@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.
Received on Mon Sep 11 04:41:14 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 10 Sep 2006 - 23:30:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.