talira

Tidyverse package for reshaping R data into tidy form: pivoting, nesting and rectangling

open sourceMITfree

tidyr is the tidyverse's R package for making data tidy, where each variable is a column, each observation a row and each value a cell. It pivots data between long and wide forms (pivot_longer, pivot_wider), turns deeply nested lists such as parsed JSON into tidy tibbles (unnest_longer, unnest_wider, hoist), nests and unnests grouped data, splits and combines character columns (separate_wider_delim, unite), and handles missing values (complete, drop_na, fill, replace_na). It supersedes reshape2 and reshape, and Posit funds it.

Problems it solves

  • convert a data frame from wide to long format in R
  • pivot long data into wide columns in R
  • turn nested JSON lists into a tidy data frame in R
  • split one text column into several columns in R
  • fill in missing values or make implicit missing rows explicit in R

Features

  • pivot_longer and pivot_wider
  • Rectangling nested lists into tibbles
  • nest and unnest
  • separate_wider_delim, separate_wider_position, separate_wider_regex and unite
  • complete, drop_na, fill and replace_na for missing values