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.
本练习是课程的一部分
Practicing Statistics Interview Questions in R
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Calculate means across groups
tapply(___, PlantGrowth$group, FUN = ___)
# Graphically compare statistics across groups
___(___ ~ group, data = ___)