*Hi Bert and all,*
*
*
*Thanks a lot for your response. Bert's method works very well.*
*
*
*
*
2013/3/8 Bert Gunter
> 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.14
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.
-- Ber
Dear Marin,
May be not the cleanest way to do it, but the following seems to work:
write.table(as.character(round(pi, 10)), "pi.txt", row.names = FALSE,
col.names = FALSE, quote = FALSE)
Best,
Jorge.-
On Fri, Mar 8, 2013 at 11:24 AM, Marino David wrote:
> Hi Bert,
>
> I read both options and
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
i
Hi Bert,
I want to save the data into .txt file for another software process.
Thanks for suggestion.
2013/3/8 Bert Gunter
> ?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
?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. "
6 matches
Mail list logo