statrefs home‎ > ‎Main‎ > ‎Methods‎ > ‎Data Management‎ > ‎

Data Table Unstacked (Wide) vs Stacked (Long) Format


 
In R, the nomenclature is called either 'wide' or 'long' format. 
  • See 'reshape' utility (or reshape package). 
  • See 'melt'.
  • See 'plyr'.


In Statistica, the equivalent is "stacking" or "unstacking" under the Data menu. 



The WIDE format is one that is often used in MS Excel as data is collected from an experiment.

For analysis, the WIDE format is useful for Repeated Measures (including the dependent variables t-test), MANOVA, and similar methods.  When using Statistica, it can also be used for an independent variables t-test "by variables".

The LONG format is the more common format for ANOVA, DOE, Regression, and similar methods.

When transferring MS Excel data in the WIDE format to the LONG format, the column headers in the WIDE format become a grouping variable in the LONG format.





STACKED DATA (long format)



WEEK DAY SALES
week 1 Mon 1501.192
week 1 Tue 1812.06
week 1 Wed 1224.394
week 1 Thu 1605.722
week 1 Fri 1245.945
week 2 Mon 1315.457
week 2 Tue 1178.331
week 2 Wed 1983.602
week 2 Thu 1047.684
week 2 Fri 1135.383
week 3 Mon 1855.711
week 3 Tue 1005.937
week 3 Wed 1639.02
week 3 Thu 1102.53
week 3 Fri 1005.263



UNSTACKED DATA (wide format)






WEEK    Mon    Tue    Wed    Thu    Fri
week 1 1501.192 1812.06 1224.394 1605.722 1245.945
week 2 1315.457 1178.331 1983.602 1047.684 1135.383
week 3 1855.711 1005.937 1639.02 1102.53 1005.263





Subpages (1): Unstacking Data
Comments