描述性统计
本练习将演示如何从 abalone 数据集获取单个变量的基础描述性统计,以及一次性获取多个变量的统计。您将对单个变量使用 pull()、mean() 和 median() 函数;并使用 select() 和 summary() 获取多个变量的汇总统计。
abalone 数据集和 dplyr 包已为您加载。
本练习是课程的一部分
面向 SAS 用户的 R
练习说明
- 使用
pull()和mean()两个函数,求鲍鱼的平均长度。 - 使用
pull()和median()两个函数,求鲍鱼的中位数整重(whole weight)。 - 使用
select()和summary()两个函数,获取直径和壳重的汇总统计。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Find mean length of abalones using pull() and mean()
abalone %>%
pull(___) %>%
mean()
# Find the median wholeWeight of the abalones
___ %>%
___ %>%
___
# Get descriptive statistics of diameter and shellWeight
___ %>%
select(___, ___) %>%
___