Create a ggplot object using the pipe to assign the heights data
to a ggplot object. Assign height to the x values through the aes
function.
Now we are ready to add a layer to actually make the histogram. Use the geom_histogram
function to make the histogram.
Note that when we run this code we get the
warning: stat_bin() using bins = 30. Use the binwidth argument to change the histogram to use bins of size 1 inch.
Store the resulting ggplot object in p.