unnest_auto: Automatically call 'unnest_wider()' or 'unnest_longer()'

View source: R/unnest-auto.R

unnest_autoR Documentation

Automatically call unnest_wider() or unnest_longer()

Description

unnest_auto() picks between unnest_wider() or unnest_longer() by inspecting the inner names of the list-col:

  • If all elements are unnamed, it uses unnest_longer(indices_include = FALSE).

  • If all elements are named, and there's at least one name in common across all components, it uses unnest_wider().

  • Otherwise, it falls back to unnest_longer(indices_include = TRUE).

It's handy for very rapid interactive exploration but I don't recommend using it in scripts, because it will succeed even if the underlying data radically changes.

Usage

unnest_auto(data, col)

Arguments

data

A data frame.

col

<tidy-select> List-column to unnest.


hadley/tidyr documentation built on Feb. 3, 2024, 10:45 a.m.