Rearrange data tables into wide or long structure.