tidyr has two tools for reshaping data:
gather (wide to long) and
spread (long to wide).
See Reshaping data for other options.
Reshape from long to wide format with spread()
This modified text is an extract of the original Stack Overflow Documentation created by following contributors
and released under CC BY-SA 3.0