Cloudy with a Chance of Words Lots of fun projects in the works, so today's post will be short - a demonstration on how to create wordclouds, both with and without sentiment analysis results. While I could use song lyrics again, I decided to use a different dataset that comes with the quanteda packages: all 58 Inaugural Addresses, from Washington's first speech in 1789 to Trump's in 2017.library(quanteda) #install with install.packages(&quot;quanteda&quot;) if neededdata(data_corpus_inaugural)speeches %count(word, sort = TRUE)obama_words %__%inner_join(get_sentiments(&quot;nrc&quot;) %__%filter(sentiment %in% c(&quot;positive&quot;,&quot;negative&quot;))) %__%filter(n __ 1) %__%acast(word ~ sentiment, value.var = &quot;n&quot;, fill = 0) %__%comparison.cloud(colors = c(&quot;red&quot;,&quot;blue&quot;))## Joining, by = &quot;word&quot;The acast statement reshapes the data, putting our sentiments of positive and negative as separate columns. Setting fill = 0 is important, since a negative word will be missing a value for the positive column and vice versa; without fill = 0, it would drop any row with NA in one of the columns (which would be every word in the set). As a sidenote, we could use the comparison cloud to compare words across two documents, such as comparing two Presidents. The columns would be counts for each President, as opposed to count by sentiment.Interestingly, the NRC classifies &quot;government&quot; and &quot;words&quot; as negative. But even if we ignore those two words, which are Obama's most frequent, the negatively-valenced words are much larger than most of his positively-valenced words. So while he uses many more positively-valenced words than negatively-valenced words - seen by the sheer number of blue words - he uses the negatively-valenced words more often. If you were so inclined, you could probably run a sentiment analysis on his speeches and see if they tend to be more positive or negative, and/or if they follow arcs of negativity and positivity. And feel free to generate your own wordcloud: all you'd need to do is change the filter(President == &quot;&quot;) to whatever President you're interested in examining (or whatever text data you'd like to use, if President's speeches aren't your thing).