This might be an easy question for regular ggplot users, but I'm running into some unexpected behavior between ggplot
and qplot
and I don't understand the reason.
I'm trying to plot a simple histogram with counts. This works well with qplot
:
x <- c(1,2,3,3,4,5)
qplot(x)
However, when I try to achieve the same result using ggplot
, I get the following error message. Any suggestions of what might be the problem?
ggplot(data=x, aes(x)) + geom_histogram()
Error: ggplot2 doesn't know how to deal with data of class numeric