Categorical Data in the Tidyverse
Emily Robinson
Data Scientist
forcats
packageAnnual Income Options:
library(fivethirtyeight)
print(college_all_ages)
# A tibble: 173 x 11
major_code major major_category total employed
<int> <chr> <chr> <int> <int>
1 1100 General Ag… Agriculture & Na… 128148 90245
2 1101 Agricultur… Agriculture & Na… 95326 76865
3 1102 Agricultur… Agriculture & Na… 33955 26321
4 1103 Animal Sci… Agriculture & Na… 103549 81177
# ... with 163 more rows, and 6 more variables:
# employed_fulltime_yearround <int>, unemployed <int>,
# unemployment_rate <dbl>, p25th <dbl>, median <dbl>,
# p75th <dbl>
is.factor(college_all_ages$major_category)
FALSE
Categorical Data in the Tidyverse