reshape2 is an R package written by Hadley Wickham that makes it easy to transform data between wide and long formats.
reshape2 is based around two key functions: melt and cast:
- melt takes wide-format data and melts it into long-format data.
cast takes long-format data and casts it into wide-format data.
Think of working with metal: if you melt metal, it drips and becomes long. If you cast it into a mould, it becomes wide.