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

-----Original Message-----
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] 
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,                  [EMAIL PROTECTED]
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

Reply via email to