Tidy datasets must have a single column for each variable. Occasionally, multiple variable names are placed in a single column with their corresponding value placed in another. The general format for this kind of messy data is as follows:
![](https://static.packt-cdn.com/products/9781784393878/graphics/assets/66c39b9f-ab17-47c5-bed6-ba8b5ea05e17.png)
In this example, the first and last three rows represent two distinct observations that should each be rows. The data needs to be pivoted such that it ends up like this:
![](https://static.packt-cdn.com/products/9781784393878/graphics/assets/322a12bf-2fb2-4f71-b2c9-4116878c69fa.png)