[R] histogramm$density

austernkommunikation at googlemail.com
Fri, 26 Dec 2008 12:02:12 -0000

hello,


i am using the hist function with classified values. The class breaks are >1,
so
histogram$density is != 1.

How to plot the histogram with freq=FALSE and the real class density values.
I used:

> h2 = hist(value, breaks = breaks_vector)
> h2$density = round(h2$counts/sum(h2$counts), 2)
> h2$intensities = h2$density
> plot(h2, freq=F)

but this isn't the best way, i think.

Also i would like to add the density function line with

>  lines(density(value)

but of course it doesn't fit, due to the modified h2$density values.

Where is my fault?

thank you!

regards,

  Fred