-
Notifications
You must be signed in to change notification settings - Fork 420
Closed
Description
Found while staring at spreadsheet cell data.
library(tidyverse)
dat <- tibble(
row = 2:3,
col = 2L,
loc = c("B2", "B3"),
blah = list(
list(whatever = "a", foofy = "b"),
list(whatever = "c", foofy = "d")
)
)
# this is the result I expect from unnest_auto()
dat %>% unnest_wider(blah)
#> # A tibble: 2 x 5
#> row col loc whatever foofy
#> <int> <int> <chr> <chr> <chr>
#> 1 2 2 B2 a b
#> 2 3 2 B3 c d
# lots of noise about name repair but:
# * no actual unnesting happens
# * original `col` variable gets renamed to `...2`
dat %>% unnest_auto(blah)
#> Using `unnest_wider(blah)`; elements have 2 names in common
#> New names:
#> * `` -> ...1
#> New names:
#> * `` -> ...1
#> New names:
#> * ...1 -> ...2
#> # A tibble: 2 x 4
#> row ...2 loc blah
#> <int> <int> <chr> <list>
#> 1 2 2 B2 <named list [2]>
#> 2 3 2 B3 <named list [2]>Created on 2020-05-14 by the reprex package (v0.3.0.9001)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels