Preparing your data for analysis with the tidyr package

The tidyr package is another gift from Hadley Wickham. This package provides functions to make your data tidy.

This means that after applying the tidyr package's function, your data you will be arranged as per the following rules:

  • Each column will contain an attribute
  • Each row will contain an observation
  • Each cell will contain a value

These rules will produce a dataset similar to the following one:

Preparing your data for analysis with the tidyr package

This structure, besides giving you a clearer understanding of your data, will let you work with it more easily.

Furthermore, this structure will let you take full advantage of the inner R-vectorized structure. ...

Get RStudio for R Statistical Computing Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.