[Rd] Suppressing Scientific Notation
Prof Brian Ripley
ripley at stats.ox.ac.uk
Fri May 2 20:53:41 MEST 2003
On Fri, 2 May 2003, Martin Maechler wrote:
> >>>>> "BDR" == Prof Brian Ripley <ripley at stats.ox.ac.uk>
> >>>>> on Fri, 2 May 2003 17:07:50 +0100 (BST) writes:
>
> BDR> A couple of hints:
> BDR> 1) You don't need to touch the internal code for options: you can just
> BDR> set options(scipen=100), or rely on it being unset for the default.
>
> BDR> 2) I would do something like
>
> BDR> R_print.scipen = asInteger(GetOption(install("scipen"), rho));
> BDR> if(R_print.scipen == NA_INTEGER) R_print.scipen = 0;
>
> BDR> Your way you need GetOptionSciPen defined in some
> BDR> common header.
>
> I remember vaguely that the more tedious way we do for the
> "digits" leads to quite substantial speed improvements as
> opposed to always have to go through GetOption(install("..."), rho).
> Printing of "numeric" data is such a basic thing that it should
> be as fast as possible. I said *vaguely* though ...
It's not avoiding that: GetOptionDigits is called by PrintDefaults and
that looks up the .Options variable every time. You do need to look up
the options on each call (possibly internal) to print, as there are
scoping possibilities with options() (hence that rho in the GetOption
call).
As far as I can see this only called in print.c, but I presume it was
intended to be used more widely.
My point was that in the patch GetOptionSciPen was not defined to return
integer ....
Brian Ripley
--
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-devel
mailing list