[R] Number Format

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Oct 14 11:48:27 CEST 2003


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




More information about the R-help mailing list