Reshaping
Reshaping: Wide to Long with melt, Long to Wide with pivot.
Updated
- Wide to Long with melt (Journeyman): A wide table keeps one kind of value in many columns, a column per quiz, which reads well but is hard to filter and group, and melt turns it into a long table with one row per value, named with id_vars, var_name and value_name, the shape textbooks call tidy data.
- Long to Wide with pivot (Journeyman): pivot turns a long table back into a wide one, with index naming the rows, columns naming the column headers and values filling the cells, stops with an error when two rows would land in the same cell, and pivot_table, which combines those rows instead, is the right choice only when combining them is what you meant.