[Rd] signif {base}: changes to scientific notation
Wolfram Fischer - Z/I/M
wolfram@fischer-zim.ch
Fri Feb 7 11:14:02 2003
format() did not well the job I wanted.
But I arrived to solve my problem using (e.g.):
formatC( signif( 1.234 * 10^(1:8), 3 ), digits=7, flag='-' )
--- In reply to: ---
>Date: 06.02.03 15:53 (+0000)
>From: ripley@stats.ox.ac.uk
>To: To Wolfram Fischer - Z/I/M
>Cc: r-devel@stat.math.ethz.ch
>Subject: Re: [Rd] signif {base}: changes to scientific notation
>
> You are confusing signif() and printing!
>
> signif() returns a real number.
>
> Printing does exactly what it is described to do, and has no concept of
> how the number was produced.
>
> I guess you were looking for format(), which allows more control.
>
> On Thu, 6 Feb 2003, Wolfram Fischer - Z/I/M wrote:
>
> > PROBLEM
> > `signif' does change to scientic notation
> > at different levels depending on the number
> > of significant digits in the input.
> >
> > This can generate tables where figures change
> > ``irregularly'' from normal to scientific notation.
> >
> >
> > PROPOSAL
> > The change to the scientific notation should
> > be made only if the figure in scientific notation
> > - with potentially as many significant digits as
> > given as argument to the call of `signif' -
> > would be shorter than the figure in normal notation.
>
> This is a misunderstanding of what is happening
>
> --
> Brian D. Ripley, ripley@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