0

I would like to know how to reverse the unnest_token function in order to export the tweets and work in python.

Here my dataset

ID DATE          TWEETS
1  2020-02-29    people tends stay home reach customer directly bulk email 

Here what I applied

  flood_tweet_messages <- df %>%
  dplyr::select(ID, cleaned_tweets) %>%
  unnest_tokens(word, cleaned_tweets) %>%

and I got this

ID word

1  people
1  tends
1  stay 
1  home

How can I reverse the process and go back to the original form of the dataset? Is it possible to keep the date in the unnested dataset? How?

Thanks everyone for your help!

ianux22
  • 405
  • 4
  • 16

1 Answers1

0

This solved the problem!

df %>% group_by(ID) %>% summarize(cleaned_tweets = str_flatten(word, " "))

Thanks to the user @Phil

ianux22
  • 405
  • 4
  • 16