I have a nested list of lists:
data = list(a = list(1, 2, 3), b = list("foo"), c = list("toast", "onions"))
How can I convert this into a single row of a data.frame or tibble? I would like the lists with more than one element (a
and c
here) to be kept as lists, and the single-element (b
) to be a regular value.
Expected output is:
# A tibble: 1 x 3
a b c
<list> <chr> <list>
1 <list [3]> foo <list [2]>