Long data stores repeated measurements in separate rows, with columns identifying the measured variable and its context. Compared with wide data, this arrangement often fits analysis and visualization workflows more naturally. section 2.7 section 2.1
A wide NBA table can become long data by:
- Selecting the identifier column, such as Team, and the repeated year or season columns. section 14.2.1
- Using tidyr::pivot_longer() to move former column names into an identifier column and former cell values into a measurement column. section 14.2.1
- Checking dimensions and sample rows to confirm that each record represents one team-and-season combination. section 14.2.1
first_salaries %>%
pivot_longer(col = c(w2017:w2008),
names_to = "year",
values_to = "wins") -> first_stats
second_salaries %>%
pivot_longer(col = c(pc2017:pc2008),
names_to = "season",
values_to = "playoffs") -> second_stats
Reshape regular-season wins and postseason results into long tibbles with meaningful identifier and value columns. section 14.2.1

