[R] Rounding

Chin-Shan Chuang chinshan.chuang at stanfordalumni.org
Thu Sep 19 13:44:48 CEST 2002


Hi, would taking log base 10 of the number help?  For example, a number
that's >= 100 and < 1000 would have log base 10 >= 2 and < 3.  Use
floor on this.

Ko-Kang Kevin Wang <kwan022 at stat.auckland.ac.nz> wrote:

Now my questions is: how do I work out the number of digits x has?  For
example in this case I have 3 digits for x (4, 5, and 9), hence I can
divide it by 100 first, floor() or ceiling() the result, then times 100.  

If I have n digits for x, this means I want to divide by (n - 1).  

But I'm not sure how to find n :-(


____________________________________________________________________
   

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list