Hi, I have a following vector:> smallch[1] 0.0652840 0.1181300 0.0319370 0.0155700 0.0464110 0.0107850 [7] 0.0158970 0.0375900 0.0603090 0.0310300 0.0105920 0.0540580 [13] -0.0177740 0.0039393 Pretty (R 1.5.1) has problems with zero:> pretty(smallch)[1] -2.000000e-02 -3.469447e-18 2.000000e-02 4.000000e-02 6.000000e-02 [6] 8.000000e-02 1.000000e-01 1.200000e-01 You notice -3.46e-18 instead of 0. Is this feature changed in 1.6.0, or are there any simple ways to get around of it? Ott> version_ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major 1 minor 5.1 year 2002 month 06 day 17 language R -- Ott Toomet otoomet at econ.au.dk --------------------------------------------------------- (o_ (*_ (O_ (o< -! (o<)< //\ //\ //\ //\ //\ V_/_ V_/_ V_/_ V_/_ V_/_ standard drunken shocked noisy penguin penguin penguin penguin penguin eating fish -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Ott Toomet <otoomet at econ.au.dk> wrote:> Pretty (R 1.5.1) has problems with zero:> pretty(smallch) [1] -2.000000e-02 -3.469447e-18 2.000000e-02 4.000000e-02 6.000000e-02 [6] 8.000000e-02 1.000000e-01 1.200000e-01> You notice -3.46e-18 instead of 0. Is this feature changed in 1.6.0, > or are there any simple ways to get around of it?I mentioned this in R-devel on June 14, 2002 ("pretty() sometimes isn't"). It derives from the roundoff error introduced in seq(-.02, .12, length=8). I suggested that the last line of the code for pretty() should get a zapsmall() around it: pretty <- function(...) { ... zapsmall(seq(z$l, z$u, length = z$n + 1)) } Since that hasn't been implemented, you could simply put a zapsmall() around every pretty() in your code. -- -- David Brahm (brahm at alum.mit.edu) -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._