1. Learn
  2. /
  3. Courses
  4. /
  5. Practicing Statistics Interview Questions in R

Exercise

Comparing groups

In this exercise, you will compare distributions of data across groups.

The PlantGrowth dataset from the datasets package contains results from an experiment on yields. The dataset contains two variables:

  • group - indicates if the given result is from the control group or one of the two treatment groups,
  • weight - the dried weight of plants used to measure yields.

Recall that tapply() can be used to compute metrics across groups.

For example,

tapply(df$x, df$grp, FUN = median)

returns median of x across grp from the df data frame.

Your task is to calculate means and visualize five common statistics of the yields' weight. The graphical depiction will help you to compare the differences in the response variable across groups.

Instructions 1/2

undefined XP
    1
    2
  • Calculate the mean weight for the control and the two treatment groups. Use the PlantGrowth dataset.
  • Visualize five common statistics (minimum, first quartile, median, third quartile, and maximum) of weight across groups.