Interactive Course

# Categorical Data in the Tidyverse

Get ready to categorize! In this course, you will work with non-numerical data, such as job titles or survey responses, using the Tidyverse landscape.

• 4 hours
• 13 Videos
• 44 Exercises
• 3,089 Participants
• 3,600 XP

### Course Description

As a data scientist, you will often find yourself working with non-numerical data, such as job titles, survey responses, or demographic information. R has a special way of representing them, called factors, and this course will help you master working with them using the tidyverse package forcats. We’ll also work with other tidyverse packages, including ggplot2, dplyr, stringr, and tidyr and use real world datasets, such as the fivethirtyeight flight dataset and Kaggle’s State of Data Science and ML Survey. Following this course, you’ll be able to identify and manipulate factor variables, quickly and efficiently visualize your data, and effectively communicate your results. Get ready to categorize!

1. 1

#### Introduction to Factor Variables

Free

In this chapter, you’ll learn all about factors. You’ll discover the difference between categorical and ordinal variables, how R represents them, and how to inspect them to find the number and names of the levels. Finally, you’ll find how forcats, a tidyverse package, can improve your plots by letting you quickly reorder variables by their frequency.

2. #### Creating Factor Variables

Having gotten a good grasp of forcats, you’ll expand out to the rest of the tidyverse, learning and reviewing functions from dplyr, tidyr, and stringr. You’ll refine graphs with ggplot2 by changing axes to percentage scales, editing the layout of the text, and more.

3. #### Manipulating Factor Variables

You’ll continue to dive into the forcats package, learning how to change the order and names of levels and even collapse them into one another.

4. #### Case Study on Flight Etiquette

In this final chapter, you’ll take all that you’ve learned and apply it in a case study. You’ll learn more about working with strings and summarizing data, then replicate a publication quality 538 plot.

1. 1

#### Introduction to Factor Variables

Free

In this chapter, you’ll learn all about factors. You’ll discover the difference between categorical and ordinal variables, how R represents them, and how to inspect them to find the number and names of the levels. Finally, you’ll find how forcats, a tidyverse package, can improve your plots by letting you quickly reorder variables by their frequency.

2. #### Manipulating Factor Variables

You’ll continue to dive into the forcats package, learning how to change the order and names of levels and even collapse them into one another.

3. #### Creating Factor Variables

Having gotten a good grasp of forcats, you’ll expand out to the rest of the tidyverse, learning and reviewing functions from dplyr, tidyr, and stringr. You’ll refine graphs with ggplot2 by changing axes to percentage scales, editing the layout of the text, and more.

4. #### Case Study on Flight Etiquette

In this final chapter, you’ll take all that you’ve learned and apply it in a case study. You’ll learn more about working with strings and summarizing data, then replicate a publication quality 538 plot.

### What do other learners have to say?

“I've used other sites, but DataCamp's been the one that I've stuck with.”

Devon Edwards Joseph

Lloyd's Banking Group

“DataCamp is the top resource I recommend for learning data science.”

Louis Maiden

“DataCamp is by far my favorite website to learn from.”

Ronald Bowers

Decision Science Analytics @ USAA

##### Emily Robinson

Data Scientist at DataCamp

Emily works with the growth team at DataCamp on creating a robust A/B testing system. She previously worked at Etsy as a data analyst with the search team and earned her master's degree at INSEAD in Organizational Behavior. She is a vocal supporter of diversity in Data Science and tech in general and serves as a board member of the NYC R-Ladies chapter. Follow her at @robinson_es on Twitter and on her blog, Hooked on Data

See More
##### Collaborators
• Chester Ismay

• Becca Robins