How to export data with defined decimal places
?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 <davidmarino838 at 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 at 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