检查层级
继续加深对 CurrentJobTitleSelect 的理解。上一题中,您已经得到它有多少个层级,但同样重要的是这些层级的具体名称。和上一题一样,我们将使用 pull 从数据集 responses_as_factors 中提取 CurrentJobTitleSelect 的值。pull 可以与 $ 互换,用于把表格中的某一列提取为向量。例如,mean(mtcars$mpg) 等同于 mean(mtcars %>% pull(mpg)),也可以写成 mtcars %>% pull(mpg) %>% mean()。
本练习是课程的一部分
Tidyverse 中的分类数据
练习说明
- 使用
pull()提取CurrentJobTitleSelect列。 - 获取该因子的层级名称。
交互式实操练习
通过完成这段示例代码来试试这个练习。
responses_as_factors %>%
# Pull CurrentJobTitleSelect
___(CurrentJobTitleSelect) %>%
# Get the values of the levels
___