Data Manipulation With Dplyr in R
What you’ll learn
-
Filter data frames using various conditions
-
Select and remove data frame columns (variables)
-
Sort data frames by column values
-
Create new variables from the existing ones
-
Compute summary statistics for our data frame
-
Other useful operations (count data fame rows, select top rows, select rows at random etc.)
-
Chaining dplyr commands to write powerful data manipulation code
-
Joining data frames (five joining types)
-
Combining dplyr with ggplot2 to create meningful charts
Requirements
-
Basic R programming knowledge
Description
Data manipulation is a vital data analysis skill – actually, it is the foundation of data analysis. This course is about the most effective data manipulation tool in R – dplyr!
As a data analyst, you will spend a vast amount of your time preparing or processing your data. The goal of data preparation is to convert your raw data into a high quality data source, suitable for analysis. More often than not, this process involves a lot of work. The dplyr package contains the tools that can make this work much easier.
dplyr has a few important advantages over other data data manipulation tools or functions:
- it’s much faster (25-30 times faster)
- its code is easier to write and understand
- it can use chaining to build sequences of commands, thus making the code even cleaner and faster to execute
For these reasons, dplyr quickly began the most popular data manipulation tool among R data scientists. When you finish this course, you will be able to
It is a short course, but it is focused on the most essential commands and functions of the dplyr package, those commands that you will likely use most often.
So let’s see what you are going to learn in this course.
The first section covers the five core dplyr commands. These commands are: filter, select, mutate, arrange and summarise. You will need this commands practically every time when you work with dplyr. They are used to subset data frames, compute new variables, sort data frames, compute statistical indicators and so on. Here’s a few real life scenarios of their utilization:
- you need to extract from your respondents data set the male subjects with an income greater than $30,000
- you need to compute each respondent’s income per family member, knowing the total income and the number of family members
- you have a data set with 27 variables, but you only need 6 for your analysis (so you want to remove the extra variables)
- you have to sort your employees data set by salary
- you need to compute the average satisfaction towards a product, knowing each individual customer satisfaction etc.
The second section approaches other important dplyr commands and functions. In this section you’ll learn:
- how to count the observation in a certain group
- how to extract a random sample from your data frame
- how to extract the top entries from your data frame, based on a given variable
- how to visualize the structure of your data set
- how to use the set operations in dplyr (if you have used these operations in base R, you’ll see that dplyr takes them to a whole new level).
In the third section you’ll start to take advantage of the true power of dplyr. Here we’ll talk about chaining – creating sequences of dplyr commands that accomplish multiple tasks with one click only.
The fourth section is about joining data frames with dplyr. This is a very important topic, because many times your data will be found in several data frames. So you will need to join these data frames into only one, suitable for your analyses. We are going to look at five join types available in dplyr: inner_join, semi_join, left_join, anti_join and full_join. We are going to examine the output of each join type using a simple example.
In the fifth section we’ll learn how to combine the dplyr and ggplot2 (using chaining) commands to build expressive charts and graphs. For example, if you want to represent the income distribution for the subjects with a higher education only, or the relationship between income and education level for the female subjects only, in this section you will learn exactly how to do it.
Every command is illustrated with video, both the syntax and the output being explained in detail. At the end of the course, a big number of practical exercises are proposed. By doing these exercises you’ll actually apply in practice what you have learned.
Join this course right now and acquire a critical data analysis ability – data manipulation!
Who this course is for:
- People who want to become R analysts
- Students and statisticians who want to learn R
- People who want to learn the fundamentals of data manipulation using R