Learning>Rawgraphs 1.0

Stack your unstacked data (meet the unpivoter) (RAWGraphs 1.0)

2 min.unpivoter

Wide and narrow (sometimes un-stacked and stacked) are terms used to describe two different presentations for tabular data. RAWGraphs requires in most of the cases data in the narrow format: in this guide you’ll learn how to use your data in RAWGraphs even it’s in the wide format.

Stack your unstacked data (meet the unpivoter) (RAWGraphs 1.0)

Wide, or unstacked data is presented with each different data variable in a separate column. Narrow, or stacked data is presented with one column containing all the values and another column listing the context of the value.

Here are two example of the same data in the two formats.

Wide (or unstacked) table:

Person Age Weight
Bob 32 128
Alice 24 86
Steve 64 95

The same data in a narrow (stacked) table:

Person Variable Value
Bob Age 32
Bob Weight 128
Alice Age 24
Alice Weight 86
Steve Age 64
Steve Weight 95

RAWGraphs requires in most of the cases data in the narrow format.

Transforming data from the wide to the narrow format (operation sometimes defined unpivoting) is quite difficult with the commonly available tools.

This is the reason why we added the “Stack/unstack” function, AKA “the Unpivoter”.

01. load your data

In this tutorial we will visualize the GDP Growth as recorded by the World Bank.

We prepared a simplified version of the dataset for this tutorial, you can see it here:

You can also download it through the link on the left. Once your data is loaded, you should see this:

01 unstacked data

02. Unstack your data

In the bottom-right corner of the data field, you should see the sentence “Your data seems unstacked. Click here to stack it”, as in the image below. Click on it.

stakc unstack

A new menu (select a dimension to stack on) will appear. Open it, and select “Country Name”.

Now, the data is stacked, as in the image below:

03 stacked data

in the first column you have the names of the countries, in the second one you have the years, and in the third ones the values.

With this operation you defined the main dimension (in this case, Country Name), which became the first column of the new dataset. In the second column, named column, are listed all the remaining headers of the previous table. In the third column, named value, are listed the values of the previous table.

03. Visualize your data

You can now use this data in RAWGraph, creating for example an Horizon Graph, a Streamgraph, or an Area graph.

How to cite this guide

"Stack your unstacked data (meet the unpivoter) (RAWGraphs 1.0)", by RAWGraphs Team. Licensed under CC BY-NC-SA 4.0. Accessed: November 08, 2021, from undefined

Copy to clipboard

Have you bumped into any issue while using the app?