Wide and narrow data

Wide and narrow (sometimes un-stacked and stacked, or wide and tall) are terms used to describe two different presentations for tabular data.[1][2]

Wide

Wide, or unstacked data is presented with each different data variable in a separate column.

Person Age Weight Height
Bob 32 168 180
Alice 24 150 175
Steve 64 144 165

Narrow

Narrow, stacked, or long data is presented with one column containing all the values and another column listing the context of the value

Person Variable Value
Bob Age 32
Bob Weight 168
Bob Height 180
Alice Age 24
Alice Weight 150
Alice Height 175
Steve Age 64
Steve Weight 144
Steve Height 165

This is often easier to implement; addition of a new field does not require any changes to the structure of the table, however it can be harder for people to understand.

Implementations

Many statistical and data processing systems have functions to convert between these two presentations, for instance the R programming language has several packages such as the tidyr package. The pandas package in Python implements this operation as "melt" function which converts a wide table to a narrow one. The process of converting a narrow table to wide table is generally referred to as "pivoting" in the context of data transformations. The "pandas" python package provides a "pivot" method which provides for a narrow to wide transformation.

See also

  • Abstract data type
  • Pivot table
  • Table (information)
  • Information graphics
  • Row (database)
  • Table (database)
  • Table (HTML)

References

  1. ^ Thompson, M. E. (1997), Theory of sample surveys, Chapman & Hall, London. ISBN 0-412-31780-X
  2. ^ Chantala, K. (2006) "Using STATA to Analyze data from a Sample Survey". 1-10-2001. UNC Chapel Hill, Carolina Population Center. 10-1-2006.

External links

Look up table in Wiktionary, the free dictionary.
  • https://tidyr.tidyverse.org/articles/pivot.html
  • https://cran.r-project.org/web/packages/reshape
  • v
  • t
  • e
Visualization of technical information
Fields
  • Biological data visualization
  • Chemical imaging
  • Crime mapping
  • Data visualization
  • Educational visualization
  • Flow visualization
  • Geovisualization
  • Information visualization
  • Mathematical visualization
  • Medical imaging
  • Molecular graphics
  • Product visualization
  • Scientific visualization
  • Social visualization
  • Software visualization
  • Technical drawing
  • User interface design
  • Visual culture
  • Volume visualization
Image
typesPeople
Pre-19th century
19th century
Early 20th century
Mid 20th century
Late 20th century
Early 21st century
Related
topics
  • v
  • t
  • e
Continuous data
Center
Dispersion
Shape
Count data
Summary tables
Dependence
Graphics
Study design
Survey methodology
Controlled experiments
Adaptive designs
Observational studies
Statistical theory
Frequentist inference
Point estimation
Interval estimation
Testing hypotheses
Parametric tests
Specific tests
  • Z-test (normal)
  • Student's t-test
  • F-test
Goodness of fit
Rank statistics
Bayesian inference
Correlation
Regression analysis
Linear regression
Non-standard predictors
Generalized linear model
Partition of variance
Categorical
Multivariate
Time-series
General
Specific tests
Time domain
Frequency domain
Survival
Survival function
Hazard function
Test
Biostatistics
Engineering statistics
Social statistics
Spatial statistics
  • Category
  • icon Mathematics portal
  • Commons
  • WikiProject