
There's more...
The final graph in this recipe is an excellent example of the faceted graphics capabilities of ggplot2. Adding +facet_wrap(~make, nrow = 3) tells ggplot2 that we want a separate set of axes for each make of automobile and to distribute these subplots between three different rows. This is an incredibly powerful data visualization technique as it allows us to clearly see patterns that might only manifest for a particular value of a variable.
We kept things simple in this first data science project. The dataset itself was small--only 12 megabytes uncompressed, easily stored, and handled on a basic laptop. We used R to import the dataset, check the integrity of some (but not all) of the data fields, and summarize the data. We then moved on to exploring the data by asking a number of questions and using two key libraries, plyr and ggplot2, to manipulate the data and visualize the results. In this data science pipeline, our final stage was simply the text that we wrote to summarize our conclusions and the visualizations produced by ggplot2.