r - Unlist a data.frame column -
i have data.frame contains data of facebook page 167 objects
i take "message" column , separate hashtags stringr. produces list called "hashes" of 67.
msg <- page$message hashes <- str_extract_all(msg,"#\\s+")
i append hashes empty column created, called hashtags.
page$hashtags <- na page$hashtags <- hashes
however column "hashtags" list. if unlist(page$hashtags)
turns na
.
conversely, if unlist "hashes", can't find way re-append data.frame because have different numbers of objects.
i feel i'm missing simple , need apply
family or dplyr
?
any appreciated.
for unlisting list-columns, need call unnest
tidyr
package.
unnest(dataframe, nameofcolumns)
best,
colin
Comments
Post a Comment