[R] Bug with hist() ?
Martin Maechler
maechler at stat.math.ethz.ch
Thu Jan 31 12:50:35 CET 2008
>>>>> "NS" == Ng Stanley <stanleyngkl at gmail.com>
>>>>> on Thu, 31 Jan 2008 16:56:26 +0800 writes:
NS> Hi,
NS> Is this a bug from hist() ? The total density is greater than 1.
no, the bug is in your thinking...
Hint: 2 * 1/2 = 1
>> test
NS> [1] 0.05077802 -0.50585520 -0.98053648 -0.35513059 0.86767129 0.61736097
NS> [7] 0.14264062 0.26243841 -0.41477782 0.64172618 0.87230953 -0.62570629
NS> [13] 0.43596467 -0.93214106 -0.26781599
>> h <- hist(test, freq = FALSE, main="Histogram of correlation", ylab =
NS> "Frequency", xlab = "Correlation", ylim =c(0.0, 1.0))
>> h$breaks
NS> [1] -1.0 -0.5 0.0 0.5 1.0
>> h$density
NS> [1] 0.5333332 0.4000000 0.5333333 0.5333333
>> h$counts
NS> [1] 4 3 4 4
NS> Thanks
NS> Stanley
NS> [[alternative HTML version deleted]]
NS> ______________________________________________
NS> R-help at r-project.org mailing list
NS> https://stat.ethz.ch/mailman/listinfo/r-help
NS> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
NS> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list