[R] Several Basic Questions

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue May 20 17:38:36 CEST 2003


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




More information about the R-help mailing list