It is the 'area' under the curve that sums to zero.  Look at what the
difference is between the 'breaks' (0.02).  multiply this by 50 and
you get 1.

On Sun, Jul 26, 2009 at 7:43 AM, Jan
Teichmann<jan.teichm...@googlemail.com> wrote:
> Hello,
>
> I have a problem with the hist() function and showing densities. The
> densities sum to 50 and not to 1! I use R version 2.9.1 (2009-06-26) and
> I load the seqinR library.
>
> My data is the following vector:
> [1] 0.1400000 0.2000000 0.2200000 0.2828283 0.1600000 0.1600000
> 0.3600000
> [8] 0.1600000 0.2200000 0.2600000 0.2000000 0.3000000 0.2200000
> 0.2342342
> [15] 0.1800000 0.2200000 0.1600000 0.2300000 0.2000000 0.2200000
> 0.2400000
> [22] 0.2000000 0.2200000 0.2200000 0.2600000 0.2000000 0.1600000
> 0.2200000
> [29] 0.2342342 0.2000000 0.2200000 0.2000000 0.2000000 0.1400000
> 0.1800000
> [36] 0.2200000 0.1600000 0.1600000 0.1400000 0.2200000 0.2000000
> 0.2871287
> [43] 0.2900000 0.2000000 0.1836735 0.2000000 0.2000000 0.2900000
> 0.2400000
> [50] 0.2200000 0.2800000 0.2000000 0.2745098 0.2200000 0.2300000
> 0.1800000
> [57] 0.2300000 0.1800000 0.2600000 0.2200000 0.2222222 0.2200000
> 0.2600000
> [64] 0.2200000 0.2200000 0.2600000 0.2200000 0.2000000 0.2200000
>
> I use the following command:
> tmp <- hist(data, freq=FALSE, plot=FALSE)
>
> and that's the result:
> $breaks
>  [1] 0.14 0.16 0.18 0.20 0.22 0.24 0.26 0.28 0.30 0.32 0.34 0.36
>
> $counts
>  [1] 10  4 15 19  8  5  2  5  0  0  1
>
> $intensities
>  [1]  7.2463754  2.8985507 10.8695652 13.7681159  5.7971014  3.6231884
>  [7]  1.4492754  3.6231884  0.0000000  0.0000000  0.7246377
>
> $density
>  [1]  7.2463754  2.8985507 10.8695652 13.7681159  5.7971014  3.6231884
>  [7]  1.4492754  3.6231884  0.0000000  0.0000000  0.7246377
>
> $mids
>  [1] 0.15 0.17 0.19 0.21 0.23 0.25 0.27 0.29 0.31 0.33 0.35
>
> $xname
> [1] "data"
>
> $equidist
> [1] TRUE
>
> attr(,"class")
> [1] "histogram"
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to