[R] hist with relative frequency

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Sun Oct 14 00:52:24 CEST 2001

Erin Hodgess <hodgess at uhddx01.dt.uh.edu> writes:

> Dear R People:
> Here is yet another histogram question (yahq), please:
> When I use the hist() command with
> freq=F, I get density on the side.
> I would really like to have relative frequency; that is,
> Rf = density/(sum(density))
> Is there a step that I'm leaving out, please?

Several people would probably contest that that is really what you
want (histograms are supposed to be density estimates), but if you
insist then you could use x <- hist(..., plot=F), normalize the count
or density component, then plot(x).

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