I have a data.frame that contains the data of a facebook page with 167 objects
I then take the "message" column and separate the hashtags from it with stringr. This produces a list called "hashes" of 67.
msg <- page$message
hashes <- str_extract_all(msg,"#\\S+")
I then append hashes to an empty column I created, called hashtags.
page$hashtags <- NA
page$hashtags <- hashes
However the column "hashtags" is now a list. If I unlist(page$hashtags)
everything turns into NA
.
Conversely, if I unlist "hashes", I can't find a way to re-append this to the data.frame because they have different numbers of objects.
I feel like I'm missing something simple and need something from the apply
family or dplyr
?
Any help is greatly appreciated.