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!
Changing data format
12. Exercise 1


That's all for this part! Let's have a quick summary of everything we learned about tidyr.

We learned only four functions in this section, but when it's time to tidy up a dataset, these four functions are very important. They are:

  • gather() – transforms variables into new columns; creates a long-format dataset.
  • spread() – spreads values across two or more columns; creates a wide-format dataset.
  • separate() – creates one or more new columns from values in one column.
  • unite() – joins two or more columns into one column.

Let's practice what we've learned.


We have a new dataset in memory, cars. It contains data about car sales, including the car brand, the owner's name and phone number, and an area code. Let's look at the data using glimpse().

Stuck? Here's a hint!