R Academy · Lesson

Data Wrangling with dplyr

Learn to filter, arrange, select, mutate, and summarize data effectively using dplyr.

Lesson 2 of 310 steps

Data Wrangling with dplyr is a free R Academy lesson on CoddyKit. This is lesson 2 of 3. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the R Academy learning path, and your progress syncs across the web and the CoddyKit app. The R Academy course includes 3 lessons in total.

Introduction to Data Wrangling with dplyr

The dplyr package provides powerful tools for filtering, arranging, selecting, and summarizing data in R.

Data Wrangling with dplyr — illustration 1

Filtering Rows

The filter() function selects rows based on conditions.

library(dplyr)
data <- mtcars %>% filter(mpg > 20)

Selecting Columns

The select() function extracts specific columns.

data <- mtcars %>% select(mpg, hp, cyl)

Arranging Data

The arrange() function sorts rows in ascending or descending order.

data <- mtcars %>% arrange(desc(mpg))

Mutating Data

The mutate() function creates new variables.

data <- mtcars %>% mutate(mpg_to_hp = mpg / hp)

Summarizing Data

The summarize() function calculates summary statistics.

summary_data <- mtcars %>% summarize(mean_mpg = mean(mpg), max_hp = max(hp))

Grouping Data

The group_by() function groups data before summarizing.

grouped_data <- mtcars %>% group_by(cyl) %>% summarize(mean_mpg = mean(mpg))

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))

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.
Data Wrangling with dplyr — illustration 10
Free to start

Learn R with an AI tutor — free

Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.

Courses
43
Lessons
159

Frequently Asked Questions

Is the “Data Wrangling with dplyr” lesson free?

Yes — any 3 lessons of the R Academy learning path, including “Data Wrangling with dplyr”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The R Academy course includes 3 lessons in total.

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, so you can start here or from the beginning and move at your own pace. This is lesson 2 of 3.

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

  1. Introduction to Tidyverse
  2. Data Wrangling with dplyr
  3. Tidying Data with tidyr
← Back to R Academy