*Hi Bert and all,*
*
*
*Thanks a lot for your response. Bert's method works very well.*
*
*
*
*


2013/3/8 Bert Gunter <gunter.ber...@gene.com>

> Use format() or formatC() to convert your numeric data to character
> and then "call write.table on that."
>
> e.g.
>
> > z <-formatC(pi,digits=10,format="f")
> > z
> [1] "3.1415926536"
>
> If this still is not clear to you, I give up, as I do not know how to
> make it any clearer. Perhaps someone else can.
>
> -- Bert
>
>
> On Thu, Mar 7, 2013 at 4:24 PM, Marino David <davidmarino...@gmail.com>
> wrote:
> > Hi Bert,
> >
> > I read both options and write.table help, but I still can't make it to
> save
> > the data into txt file with fixed precision.
> >
> > To let you know more clearly what I want, I still you use the previous
> > simple example to illustrate.
> >
> > I want to save pi into pi.txt file with 10 decimal places, that is
> > 3.1415926536. How to do it?
> >
> >
> >
> > Thanks
> >
> > Marin
> >
> >
> >
> > 2013/3/8 Marino David <davidmarino...@gmail.com>
> >>
> >> Hi Bert,
> >>
> >> I want to save the data into .txt file for another software process.
> >>
> >> Thanks for suggestion.
> >>
> >> 2013/3/8 Bert Gunter <gunter.ber...@gene.com>
> >>>
> >>> ?write.table
> >>>
> >>> which says, under details:
> >>>
> >>> "In almost all cases the conversion of numeric quantities is governed
> >>> by the option "scipen" (see options), but with the internal equivalent
> >>> of digits=15. For finer control, use format to make a character
> >>> matrix/data frame, and call write.table on that. "
> >>>
> >>> Not sure if this is what you want, as "export" is rather vague.
> >>>
> >>> -- Bert
> >>>
> >>> On Thu, Mar 7, 2013 at 12:52 PM, Marino David <
> davidmarino...@gmail.com>
> >>> wrote:
> >>> > Hi all mailing listers,
> >>> >
> >>> > I want to export data with specified precision into .txt file. How
> can
> >>> > I
> >>> > make it? See  below
> >>> >
> >>> > sprintf("%.10f",pi)
> >>> > [1] "3.1415926536"
> >>> >
> >>> > when carry out write.matrix(pi,"pi.txt"), 3.141592653589793115998 in
> >>> > pi.txt
> >>> > file not with 10 decimal places like using sprintf("%.10f",pi)
> >>> >
> >>> >
> >>> > Thanks
> >>> >
> >>> > Marino
> >>> >
> >>> >         [[alternative HTML version deleted]]
> >>> >
> >>> > ______________________________________________
> >>> > R-help@r-project.org 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.
> >>>
> >>>
> >>>
> >>> --
> >>>
> >>> Bert Gunter
> >>> Genentech Nonclinical Biostatistics
> >>>
> >>> Internal Contact Info:
> >>> Phone: 467-7374
> >>> Website:
> >>>
> >>>
> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
> >>
> >>
> >
>
>
>
> --
>
> Bert Gunter
> Genentech Nonclinical Biostatistics
>
> Internal Contact Info:
> Phone: 467-7374
> Website:
>
> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to