1. Learn
  2. /
  3. Courses
  4. /
  5. Hypothesis Testing in R

Exercise

Visualizing many categories

So far in this chapter, we've only considered the case of differences in a numeric variable between two categories. Of course, many datasets contain more categories. Before you get to conducting tests on many categories, it's often helpful to perform exploratory data analysis. That is, calculating summary statistics for each group and visualizing the distributions of the numeric variable for each category using box plots.

Here, we'll return to the late shipments data, and how the price of each package (pack_price) varies between the three shipment modes (shipment_mode): "Air", "Air Charter", and "Ocean".

late_shipments is available; dplyr and ggplot2 are loaded.

Instructions 1/2

undefined XP
    1
    2
  • Using the late_shipments dataset, group by shipment_mode.
  • Summarize to calculate the mean of pack_price as xbar_pack_price and the standard deviation of pack_price as s_pack_price.