Hi A very simple question on number formats. After some calculations, some variables I have come out looking like this: -1.892972e+00 Now apart from the fact that the "e+00" is completely redundant, I would rather have the number represented without the e bit. I want to export data like this to a text file and would rather have: -1.892972 than -1.892972e+00 I have tried options(digits = 12) or something similar but that doesn't seem to help. How can I get R to export this data without the e+00? Thanks Mick
Probably you have set options(scipen=some negative number), try with options(scipen=3). options(digits=#) for the number of digit. Best A.S. ---------------------------- Alessandro Semeria Models and Simulations Laboratory Montecatini Environmental Research Center (Edison Group), Via Ciro Menotti 48, 48023 Marina di Ravenna (RA), Italy Tel. +39 544 536811 Fax. +39 544 538663 E-mail: alessandro.semeria at cramont.it
On Tue, 14 Oct 2003, michael watson (IAH-C) wrote:> A very simple question on number formats. After some calculations, some > variables I have come out looking like this: > > -1.892972e+00 > > Now apart from the fact that the "e+00" is completely redundant, I would > rather have the number represented without the e bit. I want to export > data like this to a text file and would rather have: > > -1.892972 > > than > > -1.892972e+00 > > I have tried options(digits = 12) or something similar but that doesn't > seem to help. How can I get R to export this data without the e+00?I think you need to tell us how you got it to output that way! I get> -1.892972e+00[1] -1.892972 So I suspect this is part of a set of numbers, all in scientific format. You can control that with options(scipen=) in R 1.8.0: see its help page. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
On 14-Oct-03 michael watson (IAH-C) wrote:> A very simple question on number formats. After some calculations, > some variables I have come out looking like this: > [...] > -1.892972e+00 > > I have tried options(digits = 12) or something similar but that doesn't > seem to help. How can I get R to export this data without the e+00?Try formatC: pnorm(-6.1) [1] 5.303423e-10 formatC(pnorm(-6.1),format="f",digits=15) [1] "0.000000000530342" Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk> Fax-to-email: +44 (0)870 167 1972 Date: 14-Oct-03 Time: 11:31:02 ------------------------------ XFMail ------------------------------