Steve Wisdom
2002-Sep-27 18:36 UTC
[R] Bits of scientific notation in write.table() output
What's the preferred method for avoiding `unexpected' bits of scientific notation in write.table() output? I've found several inelegant workarounds, but I'm sure I'm overlooking an obvious answer A simple example.. .> df_data.frame(df=95000+1000*0:10); dfdf 1 95000 2 96000 3 97000 4 98000 5 99000 6 100000 7 101000 8 102000 9 103000 10 104000 11 105000> write.table(df,'c:\\df.txt',quote=F,sep='\t',row.names=F,col.names=F).. . creates a file with contents .. . 95000 96000 97000 98000 99000 1e+05 101000 102000 103000 104000 105000 .. .> version_ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 1 minor 5.1 year 2002 month 06 day 17 language R .. . Thank you Steve Wisdom -------------------------------------------------- DISCLAIMER This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail, and any attachments thereto, is strictly prohibited. If you have received this e-mail in error, please immediately notify me and permanently delete the original and any copy of any e-mail and any printout thereof. E-mail transmission cannot be guaranteed to be secure or error-free. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. NOTICE regarding privacy and confidentiality Knight Trading Group may, at its discretion, monitor and review the content of all e-mail communications. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Jason Turner
2002-Oct-01 09:11 UTC
[R] Bits of scientific notation in write.table() output
On Fri, Sep 27, 2002 at 01:36:31PM -0500, Steve Wisdom wrote:> > What's the preferred method for avoiding `unexpected' bits of scientific > notation in write.table() output? I've found several inelegant workarounds, > but I'm sure I'm overlooking an obvious answerYou have to format first, then write. Otherwise, write.table will format for you, and computers are rarely commended for their taste. Something like... write.table(format(df,format=f),file="foo.txt") read.table("foo.txt") df 1 95000 2 96000 3 97000 4 98000 5 99000 6 100000 7 101000 8 102000 9 103000 10 104000 11 105000 Jason -- Indigo Industrial Controls Ltd. 64-21-343-545 jasont at indigoindustrial.co.nz -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._