Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Tidyr
1. Cleaning up messy data with tidyr
Changing data format
Summary

Instruction

It's a sad fact that the data we get is often messy. Before we can use data, we may have to move it, format its columns, and do other organizational tasks. Fortunately, tidyverse provides us with a set of tools to make this process easier. They are found in the tidyr package, which is what this section is all about. We'll learn what "tidy" data is and how to remedy dataset disorder.

Let's start by looking at a dataset that has some problems.

Exercise

Use read_csv() to load the data from data/users.csv into memory. The file contains data about website users. Assign this data to the users variable. Use head() to view the first 10 rows.

Do you see some strange columns?

Stuck? Here's a hint!

Type:

users <- read_csv("data/users.csv")
head(users, 10)