[R] Decimal places
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed May 24 22:46:33 CEST 2006
On Wed, 24 May 2006, Robert Mcfadden wrote:
> Hello,
>
> I would like to force R to print 2 decimal places. I use options(digits=2)
> but as far as I know it prints significant digits so in certain cases is
> more then 2.
>
> Is there other way to do it?
?round, possibly
format(rounf(x, 2), nsmall = 2)
if you want exactly 2 decimal places.
--
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