When I run the code
hist(1:5)
or
hist(c(1,2,3,4,5))
The generated histogram shows that the first number \
Taking your first example, hist(1:5), you have five numbers, which get put into four bins. So two of those five get lumped into one.
The histogram has breaks at 2, 3, 4, and 5, so you can reasonably infer that the definition of hist for where a number is plotted, is:
#pseudocode
if (i <= break) { # plot in bin }
You can specify the breaks manually to solve this:
hist(1:5, breaks=0:5)
