Save up to $499! Grab all Python courses for $49 or all online courses we’ve ever launched for only $169. Only Feb 11-16. Happy Valentine's!
1. Cleaning up messy data with tidyr
Changing data format


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.


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!


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