formatWideLong function

Convert between wide and long data formats.