[R] engineering notation format

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Jul 7 08:51:48 CEST 2006


Both format and formatC (and sprintf) use C facilities for scientific 
format.  As far as I know C has no facilities for your desired format, so 
you would need to write your own C code and interface to R.

On Thu, 6 Jul 2006, Walker, Sam wrote:

> Hi,
>
> How can I format numbers to engineering notation?
>
> That is, like scientific but where the exponent is always a multiple of
> three.
>
> Some examples:
>
> 1635 000 000      => 1.635E9
>  163 500 000     => 163.5E6
> 0.000 000 000 135 => 135E-9
>
> I've tried format and formatC but I couldn't get them to work they I
> want.
>
> Any help is greatly appreciated.
>
>
> Thanks,
> Sam
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
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