Re: [R] Decimal places

From: Robert Mcfadden <robert-mcfadden_at_o2.pl>
Date: Thu 25 May 2006 - 07:08:20 EST


Thank you very much. Round(x, digids=2) works perfect. Rob

-----Original Message-----
From: Prof Brian Ripley [mailto:ripley@stats.ox.ac.uk] Sent: Wednesday, May 24, 2006 10:47 PM
To: Robert Mcfadden
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Decimal places

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

______________________________________________
R-help@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
Received on Thu May 25 07:19:08 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 25 May 2006 - 08:10:59 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.