[R] A question on histogram - area much less than 1

Rolf Turner rolf.turner at xtra.co.nz
Mon Mar 12 09:52:33 CET 2012


On 12/03/12 21:44, jpm miao wrote:
> Hello,
>
>    Thanks very much for your kind response. Yes, if I multiply by the 
> width "35", the area should be equal to one.
>
>    How can I plot the probability bars rather than density bars? That 
> is, I would like the height of the first bar to be 0.279, which is the 
> probability that the variable falls between 0 and 35.

If you want probabilities rather than densities you should be using 
barplot() rather
than histogram:

TBL <- table(Y1)
barplot(TBL/sum(TBL))

     cheers,

         Rolf Turner



More information about the R-help mailing list