{Long Vs. Wide} Data Frames

Introduction

This is an excellent resource to understand 2 types of data frame format: Long and Wide.

  • Just take a look at figure 1 inside the article
  1. Long format: ggplot2 needs in certain scenarios this kind of format to work (generally grouped plots).

  2. Wide format: On the other hand, usually when you read transnational data, you may find "long-format" and you need it in "wide" in order to create a predictive model.

Here, each row represents a case study, and each column an attribute/variable. Classical input for building a cluster or predictive model.

R Library

The most used library to achieve this is "reshape2", and, what's the difference with "reshape"?

Package author said:

"Reshape2 is a reboot of the reshape package. It's been over five years
since the first release of the package"..."reshape2 uses that knowledge to make a new package for reshaping data that is much more focused and much much faster."

Happy transforming!

Twitter

Facebook

More posts...