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.


tidyverse/tidyr documentation built on Oct. 30, 2024, 1:53 a.m.