Session Ready
Exercise

Whisker extents and outliers

Box and whisker plots have several variants. The default whiskers produced by bwplot() extend to the most extreme data point which is no more than 1.5 times the length of the box away from the box, and any data points outside that range are marked as potential outliers. A simpler variant is one where the whiskers extend to the extreme (minimum and maximum) data points.

Your task for this exercise is to produce a box-and-whisker plot where the whiskers extend to the data extremes. These calculations are controlled by the coef argument of the R helper function boxplot.stats().

  • A positive value of coef makes the whiskers extend to no more than coef times the length of the box.

  • The value of coef = 0 makes the whiskers extend to the data extremes.

A suitable value of coef can be passed directly to bwplot() as an optional argument.

Instructions
100 XP

The USCancerRates dataset has been pre-loaded and the state.ordered variable defined as in the previous exercise.

  • Using this data, create a box and whisker plot comparing rate.female across state.ordered.

  • Use the optional argument coef to make the whiskers extend to the data extremes.