Learn R Programming

tidytable (version 0.5.1)

unnest.: Unnest a nested data.table

Description

Unnest a nested data.table.

Usage

unnest.(.df, ...)

dt_unnest_legacy(.df, ...)

Arguments

.df

A nested data.table

...

Columns to unnest. If empty, unnests all list columns. tidyselect compatible.

Examples

Run this code
# NOT RUN {
nested_df <- data.table(
  a = 1:10,
  b = 11:20,
  c = c(rep("a", 6), rep("b", 4)),
  d = c(rep("a", 4), rep("b", 6))) %>%
  nest_by.(c, d) %>%
  mutate.(pulled_vec = map.(data, ~ pull.(.x, a)))

nested_df %>%
  unnest.(data)

nested_df %>%
  unnest.(data, pulled_vec)
# }

Run the code above in your browser using DataLab