Introduction to qualitative data

Categorical Data in the Tidyverse

Emily Robinson

Data Scientist

Course overview

  • Identifying and inspecting qualitative variables
  • Working with the forcats package
  • Making effective visualizations
Categorical Data in the Tidyverse

Final chapter

Categorical Data in the Tidyverse

What are qualitative variables?

  • Categorical vs. Ordinal data
Categorical Data in the Tidyverse

Categorical (nominal) data

Stock image of 7 workers with various outfits.

Categorical Data in the Tidyverse

Ordinal data

Annual Income Options:

  • "0-$50,000"
  • "$50,000-150,000"
  • "$150,000-500,000"
  • "More than $500,000"
Categorical Data in the Tidyverse

Qualitative variables in R

  • Names vs. question on programming languages
Categorical Data in the Tidyverse

Qualitative variables in R

  • Look at your whole dataset
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>
Categorical Data in the Tidyverse

Qualitative variables in R

  • Look at your variables one at a time:
is.factor(college_all_ages$major_category)
FALSE
Categorical Data in the Tidyverse

Let's practice!

Categorical Data in the Tidyverse

Preparing Video For Download...