Data Wrangling in R
2h 52mIntermediate2025-03-10
Authors

Mike Chapple
Teaching Professor at the University of Notre Dame
Course details
The tidy format provides a standardized way of organizing data values within a dataset. By leveraging tidy data principles, statisticians, analysts, and data scientists can spend less time cleaning data and more time tackling the more compelling aspects of data analysis. In this course, learn about the principles of tidy data, discover how to create and manipulate data tibbles, and find out how to use the tibbles in importing, transforming, and cleaning your data. Instructor Mike Chapple uses R and the tidyverse packages to teach the concept of data wrangling—the data cleaning and data transformation tasks that consume a substantial portion of analysts' time. He wraps up with three hands-on case studies that reinforce the data wrangling principles and tactics covered in this course.
Skills covered
RStudioRStatisticsData EngineeringData AnalysisProgramming LanguagesData ScienceBusiness Analysis and StrategyBusiness Software and ToolsOpen SourceSoftware DevelopmentDeep Dive (X:Y)
Concepts
Introduction
- Preparing for data wrangling
- What you need to know
- Exercise files
Tidy Data
- What is tidy data
- Variables, observations, and values
- Common data problems
- Using the tidyverse
Working with Tibbles
- Building and printing tibbles
- Subsetting tibbles
- Filtering tibbles
Importing Data into R
- What are CSV files
- Importing CSV files into R
- What are TSV files
- Importing TSV files into R
- Importing delimited files into R
- Importing fixed-width files into R
- Importing Excel files into R
- Reading data from databases and the web
Data Transformation
- Wide vs. long datasets
- Making wide datasets long with pivot longer()
- Making long datasets wide with pivot wider()
- Converting data types in R
- Working with dates and times in R
Data Cleaning
- Detecting outliers
- Missing and special values in R
- Breaking apart columns with separate()
- Combining columns with unite()
- Manipulating strings in R with stringr
Data Wrangling Case Study - Coal Consumption
- Understanding the coal dataset
- Reading in the coal dataset
- Converting the coal dataset from wide to long
- Segmenting the coal dataset
- Visualizing the coal dataset
Data Wrangling Case Study - Water Quality
- Understanding the water quality dataset
- Reading in the water quality dataset
- Filtering the water quality dataset
- Water quality data types
- Correcting data entry errors
- Identifying and removing outliers
- Converting temperature from Fahrenheit to Celsius
- Widening the water quality dataset
Data Wrangling Case Study - Social Security Disability
- Understanding the social security disability dataset
- Importing the social security disability dataset
- Making the social security disability dataset long
- Formatting dates in the social security disability dataset
- Fiscal years in the social security disability dataset
- Widening the social security disability dataset
- Visualizing the social security disability dataset
Conclusion
- Next steps