Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.LNX.4.44.0305201637080.27144-100000@gannet.stats>
Date: 2003-05-20T15:38:36Z
From: Brian Ripley
Subject: Several Basic Questions
In-Reply-To: <HDEPJCAKDEJMEEHKJOKECEFDCBAA.myao@ou.edu>

On Tue, 20 May 2003, Minghua Yao wrote:

> Dear Prof. Ripley,
> 
> Thank you for your reply. It works fine except for question 3. I got
> 
> > cat(format(round(z, 2)), "\n")
> 1134567
> 
> May variable z has been rounded to 0 digit behind the point at the very
> beginning. How to avoid that?

Read the help on format (and print), especially its `digits' argument.
More generally, read the help pages on functions new to you!

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