From p.dalgaard@biostat.ku.dk  Thu Nov 26 14:01:06 1998
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: 26 Nov 1998 15:01:06 +0100
Subject: hist()
In-Reply-To: Martin Maechler's message of Thu, 26 Nov 1998 14:28:12 +0100
References: <199811261328.OAA27866@sophie.ethz.ch>
Message-ID: <x2ww4iwo2l.fsf@blueberry.kubism.ku.dk>

Martin Maechler <maechler@stat.math.ethz.ch> writes:

>     BDR> Oh, and what do bincode and bincode2 do about rounding error?
>     BDR> (Nothing, I think.) 
> 
> You are right: nothing.  [src/appl/binning.c]
> However, do you think they *should* do anything at all?
> If a 'break' ("cut point") is close to a data value, there's still only one
> side of the break that the data value can go....

I think we probably should implement a fuzz-factor here to avoid sillyness
like

> cut(0.35, breaks=seq(0,1,0.05),right=F)
[1] [0.3,0.35)
Levels:  [0,0.05) [0.05,0.1) [0.1,0.15) [0.15,0.2) [0.2,0.25) [0.25,0.3) [0.3,0.35) [0.35,0.4) [0.4,0.45) [0.45,0.5) [0.5,0.55) [0.55,0.6) [0.6,0.65) [0.65,0.7) [0.7,0.75) [0.75,0.8) [0.8,0.85) [0.85,0.9) [0.9,0.95) [0.95,1) 

..   which currently happens because 

> 0.35 - 7*0.05
[1] -5.551115e-17

This doesn't happen in Splus, but that's just because it won't do
right=F...:

>  cut(seq(0,0.5,0.05), breaks=c(0,0.1,0.2,0.3,0.4,0.5))                         [1] NA  1  1  2  2  3  4  4  4  5  5
attr(, "levels"):
[1] "0.0+ thru 0.1" "0.1+ thru 0.2" "0.2+ thru 0.3" "0.3+ thru 0.4"
[5] "0.4+ thru 0.5"

>  cut(-0.35, breaks=-rev(seq(0,1,0.05)))                                       [1] 14       
attr(, "levels"):
 [1] "-1.00+ thru -0.95" "-0.95+ thru -0.90" "-0.90+ thru -0.85"
 [4] "-0.85+ thru -0.80" "-0.80+ thru -0.75" "-0.75+ thru -0.70"
 [7] "-0.70+ thru -0.65" "-0.65+ thru -0.60" "-0.60+ thru -0.55"
[10] "-0.55+ thru -0.50" "-0.50+ thru -0.45" "-0.45+ thru -0.40"
[13] "-0.40+ thru -0.35" "-0.35+ thru -0.30" "-0.30+ thru -0.25"
[16] "-0.25+ thru -0.20" "-0.20+ thru -0.15" "-0.15+ thru -0.10"
[19] "-0.10+ thru -0.05" "-0.05+ thru  0.00"



-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


hist()
Peter Dalgaard BSA