library(rtweet) library(dplyr) library(tidytext) library(stringr) library(ggplot2) library(ggwordcloud) dc <- search_tweets( "datacamp", n = 1000, include_rts = FALSE ) dc_words <- dc %>% filter( screen_name != "DataCamp", created_at >= "2020-07-01" ) %>% select(text) %>% unnest_tokens(word, text, token = "tweets", drop = FALSE) %>% filter(!str_starts(word, "@")) %>% anti_join(stop_words, by = "word") dc_words %>% left_join(get_sentiments("afinn"), by = "word") %>% filter(value <= 0) %>% count(word, value) %>% filter(n > 1) %>% ggplot() + geom_text_wordcloud(aes(label = word, size = n)) + scale_size_area(max_size = 14) + theme_minimal()