问题
I have a data frame which is made of up:
Var1 Var2 Var3
a b nested list
Nested list =
####test:
apple: a
pear: b
####test2:
apple: a
orange: c
Is there a simple way to turn the nested list in v3 of each row into further columns, with the list element names as the variable names and each list value in each cell? e.g.
Var1 Var2 Var3 apple pear orange
a b nested list a b NULL
回答1:
maybe you are looking for tidyr::spread()
. It is anyways hard to try other things without a reproducible example.
来源:https://stackoverflow.com/questions/51641404/r-unlist-list-to-columns-in-dataframe