Skip to main content
HomeRReshaping Data with tidyr

Reshaping Data with tidyr

4.8+
19 reviews
Intermediate

Transform almost any dataset into a tidy format to make analysis easier.

Start Course for Free
4 Hours15 Videos54 Exercises
15,811 LearnersTrophyStatement of Accomplishment

Create Your Free Account

GoogleLinkedInFacebook

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.
GroupTraining 2 or more people?Try DataCamp For Business

Loved by learners at thousands of companies


Course Description

Data in the wild can be scary—when confronted with a complicated and messy dataset you may find yourself wondering, where do I even start? The tidyr package allows you to wrangle such beasts into nice and tidy datasets. Inaccessible values stored in column names will be put into rows, JSON files will become data frames, and missing values will never go missing again. You'll practice these techniques on a wide range of messy datasets, learning along the way how many dogs the Soviet Union sent into space and what bird is most popular in New Zealand. With the tidyr package in your tidyverse toolkit, you'll be able to transform almost any dataset in a tidy format which will pay-off during the rest of your analysis.
For Business

GroupTraining 2 or more people?

Get your team access to the full DataCamp library, with centralized reporting, assignments, projects and more
Try DataCamp for BusinessFor a bespoke solution book a demo.

In the following Tracks

Data Manipulation with R

Go To Track

Importing & Cleaning Data with R

Go To Track

Tidyverse Fundamentals with R

Go To Track
  1. 1

    Tidy Data

    Free

    You'll be introduced to the concept of tidy data which is central to this course. In the first two lessons, you'll jump straight into the action by separating messy character columns into tidy variables and observations ready for analysis. In the final lesson, you'll learn how to overwrite and remove missing values.

    Play Chapter Now
    What is tidy data?
    50 xp
    Tidy data structure
    100 xp
    Multiple variables per column
    100 xp
    Columns with multiple values
    50 xp
    International phone numbers
    100 xp
    Extracting observations from values
    100 xp
    Separating into columns and rows
    100 xp
    Missing values
    50 xp
    And the Oscar for best director goes to ... <NA>
    100 xp
    Imputing sales data
    100 xp
    Nuclear bombs per continent
    100 xp
  2. 2

    From Wide to Long and Back

    This chapter is all about pivoting data from a wide to long format and back again using the pivot_longer() and pivot_wider() functions. You'll need these functions when variables are hidden in messy column names or when variables are stored in rows instead of columns. You'll learn about space dogs, nuclear bombs, and planet temperatures along the way.

    Play Chapter Now
  3. 3

    Expanding Data

    Values can often be missing in your data, and sometimes entire observations are absent too. In this chapter, you'll learn how to complete your dataset with these missing observations. You'll add observations with zero values to counted data, expand time series to a full sequence of intervals, and more!

    Play Chapter Now
  4. 4

    Rectangling Data

    In the final chapter, you'll learn how to turn nested data structures such as JSON and XML files into tidy, rectangular data. This skill will enable you to process data from web APIs. You'll also learn how nested data structures can be used to write elegant modeling pipelines that produce tidy outputs.

    Play Chapter Now
For Business

GroupTraining 2 or more people?

Get your team access to the full DataCamp library, with centralized reporting, assignments, projects and more

In the following Tracks

Data Manipulation with R

Go To Track

Importing & Cleaning Data with R

Go To Track

Tidyverse Fundamentals with R

Go To Track

Datasets

Nuclear explosions dataPlanet dataStar Wars dataNetflix dataANSUR II dataOlympic medals data

Collaborators

Collaborator's avatar
Amy Peterson
Collaborator's avatar
Maggie Matsui
Jeroen Boeye HeadshotJeroen Boeye

Machine Learning Engineer @ Faktion

Jeroen is a machine learning engineer working at Faktion, an AI company from Belgium. He uses both R and Python for his analyses and has a PhD background in computational biology. His experience mostly lies in working with structured data, produced by sensors or digital processes.
See More

Don’t just take our word for it

*4.8
from 19 reviews
84%
16%
0%
0%
0%
Sort by
  • Brian C.
    2 months

    This course was really useful, and I can't believe that I've been reshaping data without this comprehensive overview of tidyr.

  • Mary C.
    3 months

    Honestly a great course - super well-organized, clear, covered a decent amount of ground.

  • Lorenzo A.
    4 months

    good

  • Olimpia C.
    6 months

    Easy to follow. Learnt a lot and applied to my own dataset.

  • VICTOR R.
    6 months

    Really instructive and useful in the day-to-day analysis proyectos.

"This course was really useful, and I can't believe that I've been reshaping data without this comprehensive overview of tidyr."

Brian C.

"Honestly a great course - super well-organized, clear, covered a decent amount of ground."

Mary C.

"good"

Lorenzo A.

FAQs

Join over 14 million learners and start Reshaping Data with tidyr today!

Create Your Free Account

GoogleLinkedInFacebook

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.