I have a tibble like:
tibble(a = c('first', 'second'),
b = list(c('colA' = 1, 'colC' = 2), c('colA'= 3, 'colB'=2)))
# A tibble: 2 x 2
a b
<chr> <list>
1 first <dbl [2]>
2 second <dbl [2]>
Which a would like to turn into this form:
# A tibble: 2 x 4
a colA colB colC
<chr> <dbl> <dbl> <dbl>
1 first 1. NA 2.
2 second 3. 2. NA
I tried to use unnest()
, but I am having issues preserving the elements' names from the nested values.
b = list(c('colA' = 1, 'colC' = 2), c('colA'= 3, 'colB'=2, 'colD' = 1)))
? – Baliol