A.5 Stats

Sometimes your data must be transformed or summarized before it is mapped to an aesthetic. This is true, for example, with a histogram, where the samples are grouped into bins and counted. The counts for each bin are then used to specify the height of a bar. Some geoms, like geom_histogram(), automatically do this for you, but sometimes you’ll want to do this yourself, using various stat_xx functions.