Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Use geom_histogram() and
map a continuous variable to x (Figure 6-1):
ggplot(faithful,aes(x=waiting))+geom_histogram()
All geom_histogram()
requires is one column from a data frame or a single vector of data. For
this example we’ll use the faithful
data set, which contains data about the Old Faithful geyser in two
columns: eruptions, which is the
length of each eruption, and waiting,
which is the length of time to the next eruption. We’ll only use the
waiting column in this
example:
faithful
eruptions waiting
3.600 79
1.800 54
3.333 74
...