Histograms: default breaks

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
22 Sep 1998 16:13:09 +0200


hist() uses pretty() to set its default breaks. For integer data, this
isn't really desirable, although it is Splus compatible, because all
the values fall at one end of each bar. Wouldn't it be better with

breaks <- pretty(x)
adj <- diff(breaks[1:2])/2
breaks <- pretty(x+adj) - adj

 - or something like that? There's a slightly sticky issue involving
the possibility that pretty(x+adj) will have a different interval than
pretty(x), though.

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