Instantly share code, notes, and snippets.

Embed
What would you like to do?
Using wordcloud2 to make dynamic wordclouds
library(gutenbergr)
library(tidytext)
library(dplyr)
library(wordcloud2)
dracula<-gutenberg_download(345)
dracula$gutenberg_id<-NULL
dracula<-dracula%>%
unnest_tokens(word, text)
bing<-get_sentiments('bing')
dracula<-inner_join(dracula, bing)
words<-dracula%>%
group_by(word)%>%
summarize(count=n())%>%
arrange(count)
# Triangle shaped wordcloud
wordcloud2(words, shape='triangle', backgroundColor='black')
# Wordcloud in the shape of an image
wordcloud2(words, fig='bat.jpg')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment