Session Ready
Exercise

Graphics with formulas

Formulas can be used to describe graphics in each of the three popular graphics systems: base graphics, lattice graphics, and in ggplot2 with the statisticalModeling package. Most people choose to work in one of the graphics systems. I recommend ggplot2 with the formula interface provided by statisticalModeling.

Instructions
100 XP
  • Make a boxplot of insurance cost broken down by sex in one of the three graphics systems. All can use the same syntax: function(formula, data = AARP).
    • In base graphics, the appropriate function is boxplot().
    • In lattice graphics, use bwplot() to make the boxplot. As always, you will have to load the lattice package.
    • In the formula interface to ggplot2, use gf_boxplot(). The statisticalModeling package (which communicates with ggplot2), has been loaded for you.
  • Make a scatterplot of Cost versus Age in one of the graphics packages.
    • In base graphics: plot().
    • In lattice graphics: xyplot().
    • For ggplot graphics: gf_point().