Data Wrangling with dplyr
Learn to filter, arrange, select, mutate, and summarize data effectively using dplyr.
Data Wrangling with dplyr is a free R Academy lesson on CoddyKit — lesson 2 of 3. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the R Academy learning path, one of 3 lessons in the course, and your progress syncs across the web and the CoddyKit app.
1
Introduction to Data Wrangling with dplyr
The dplyr package provides powerful tools for filtering, arranging, selecting, and summarizing data in R.

2
Filtering Rows
The filter() function selects rows based on conditions.
library(dplyr)
data <- mtcars %>% filter(mpg > 20)3
Selecting Columns
The select() function extracts specific columns.
data <- mtcars %>% select(mpg, hp, cyl)4
Arranging Data
The arrange() function sorts rows in ascending or descending order.
data <- mtcars %>% arrange(desc(mpg))5
Mutating Data
The mutate() function creates new variables.
data <- mtcars %>% mutate(mpg_to_hp = mpg / hp)6
Summarizing Data
The summarize() function calculates summary statistics.
summary_data <- mtcars %>% summarize(mean_mpg = mean(mpg), max_hp = max(hp))7
Grouping Data
The group_by() function groups data before summarizing.
grouped_data <- mtcars %>% group_by(cyl) %>% summarize(mean_mpg = mean(mpg))8
9
Combining Multiple dplyr Functions
You can chain multiple dplyr functions together using the pipe operator %>%.
data <- mtcars %>% filter(mpg > 20) %>% select(mpg, hp) %>% arrange(desc(hp))10
Summary
In this lesson, you learned:
- How to filter, select, arrange, and mutate data using
dplyr. - How to summarize and group data.
- How to combine multiple dplyr functions using the pipe operator.

Frequently asked questions
Is the “Data Wrangling with dplyr” lesson free?
Yes — the full text of “Data Wrangling with dplyr” is free to read here on the web, and the R Academy course includes 3 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the R Academy course, upgrade to CoddyKit PRO.
What will I learn in “Data Wrangling with dplyr”?
Learn to filter, arrange, select, mutate, and summarize data effectively using dplyr. You practise R Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start R Academy?
No prior experience is required. R Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 3, so you can start here or from the beginning and move at your own pace.
How long does the “Data Wrangling with dplyr” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this R Academy lesson?
Yes. Every R Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Introduction to Tidyverse
- Data Wrangling with dplyr
- Tidying Data with tidyr