Saturday 15 September 2012

Histogram in R not looking how I expect -



Histogram in R not looking how I expect -

so i'm making basic histogram represent probability mass function of die roll. figure should easy,

x <- c(1, 2, 3, 4, 5, 6) hist(x)

seems should work, when run this, lowest bin has twice frequency. pretty clearly, values 1 , 2 getting set same bin, don't see why or how right this. tried setting right=false shifted overlap occurs: on right.

can explain why i'm getting unexpected result , how prepare please?

a simple solution:

x <- 1:6 # same x <- c(1,2,3,4,5,6) hist(x, breaks=0:6)

r histogram

No comments:

Post a Comment