12Reshaping Data with
One of the most common data wrangling challenges is adjusting how exactly row and columns are used to represent your data. Structuring (or restructuring) data frames to have the desired shape can be the most difficult part of creating a visualization, running a statistical model, or implementing a machine learning algorithm.
This chapter describes how you can use the
tidyr (“tidy-er”) package to effectively transform your data into an appropriate shape for analysis and visualization.
12.1 What Is “Tidy” Data?
When wrangling data into a data frame for your analysis, you need to decide on the desired structure of that data frame. You need to determine what each row and column will represent, so that you can consistently ...