I am trying to learn R and I just started this by going through the book "Hands-On Programming with R". I encountered a problem and can't continue because it bothers me a lot. As an exercise, I'm supposed to experiment with the ggplot2 package and make a histogram. The code to be used is as follows:
x <- c(1, 2, 2, 2, 3, 3)
qplot(x, binwidth = 1)
and the histogram should look like that in picture one. However, when I run the code my histogram doesn't look like the one in the picture (even though it should) and looks like that in picture 2. It's basically the same but 0.5 decimals to the left of where it should be.
Can some please tell me why doesn't the histogram look the same as in picture 1 and how to fix the code to make it look like that?
Picture 1: https://i.stack.imgur.com/dssBQ.jpg Picture 2: https://i.stack.imgur.com/wUk1i.jpg
