-
Notifications
You must be signed in to change notification settings - Fork 418
Closed
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorrectangling 🗄️converting deeply nested lists into tidy data framesconverting deeply nested lists into tidy data frames
Description
Inconsistency in output format that came up when processing nested lists that might be empty:
library(tidyr)
df <- tibble(
x = list(list(z = list(1)), list(z = list(2))),
y = 1:2
)
# column z as expected
df %>% unnest_wider(x)
#> # A tibble: 2 x 2
#> z y
#> <list> <int>
#> 1 <list [1]> 1
#> 2 <list [1]> 2
df <- tibble(
x = list(list(z = list()), list(z = list())),
y = 1:2
)
# column z not present
df %>% unnest_wider(x)
#> # A tibble: 2 x 1
#> y
#> <int>
#> 1 1
#> 2 2
Created on 2021-06-10 by the reprex package (v1.0.0)
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorrectangling 🗄️converting deeply nested lists into tidy data framesconverting deeply nested lists into tidy data frames