When creating histograms of non-categorical data (such as pH, temperature, etc.) you need to specify things called βbinsβ. Each bean has something called interval specified for it. For example, if I have data:
11 12 13 14 15 16 17 18 19
I can create 5 drawers with right open, left closed intervals as follows:
1st bin: [10, 12) 2nd bin: [12, 14) 3rd bin: [14, 16) 4th bin: [16, 18) 5th bin: [18, 20)
This means that the first bit will βholdβ values ββbetween 10 and 12, including 10, but not including 12. The interval notation used above is a shorthand for this:
1st bin: 10 β€ x < 12 2nd bin: 12 β€ x < 14 3rd bin: 14 β€ x < 16 4th bin: 16 β€ x < 18 5th bin: 18 β€ x < 20
So this means that the values ββ11 will go into the 1st bit, but the value 12 will go into the second bit, etc. R will perform this binning process and then draw a histogram depending on the number of elements in each box. For the above data, you will get a not interesting (or interesting, depending on your expectations) histogram that is mostly flat except for the first cell.
The following examples show what the various combinations of brackets and parentheses mean when using interval notation (suppose x is an element of a string of real numbers):
(1, 4) --> 1 < x < 4 left-open, right-open [3, 7) --> 3 β€ x < 7 left-closed, right-open (2, 9] --> 2 < x β€ 9 left-open, right-closed [5, 6] --> 5 β€ x β€ 6 left-closed, right-closed
Note that you cannot use parentheses for infinity, assuming that you are not using the extended string of the real number
(-β, β) --> -β < x < β (-β, 20] --> -β < x β€ 20 [20, β) --> 20 β€ x < β (1000, β) --> 1000 < x < β (-β, β] --> Invalid (41, β] --> Invalid
If I need left, right-open intervals, then the cells will look like this:
1st bin: (10, 12] ie 10 < x β€ 12 2nd bin: (12, 14] 12 < x β€ 14 3rd bin: (14, 16] 14 < x β€ 16 4th bin: (16, 18] 16 < x β€ 18 5th bin: (18, 20] 18 < x β€ 20
See the difference? In this case, now the values ββ11 and 12 will go into the first bit. This may change when the histogram appears, depending on how you load the data. Now, this time your histogram is still almost flat, but now the fifth bit is different from the rest (only 1 data point instead of 2 for the rest).
Now, fortunately, in R you do not need to specify bins yourself, but R is good enough to ask you if you want the boxes to be closed on the left, open open ( [a, b) ) or open on the left, closed on the right ( (a, b] ). That the difference is you get wrt the "correct" parameter in the hist() function.