O'Reilly logo

R: Recipes for Analysis, Visualization and Machine Learning by Chiu Yu-Wei, Atmajitsinh Gohil, Shanthi Viswanathan, Viswa Viswanathan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Generating a comparison cloud

A comparison cloud works on the same principles as a word cloud. A comparison cloud allows us to study the differences or similarities between two or more individuals' speeches or literature by simply plotting the word cloud of each against the other. In this recipe, we will study the inaugural speeches given by President Obama and former president George Bush. The two clouds provide us with a great contrast on how these individuals perceive the nation and its citizens. We require the wordcloud package as well as the tm package to generate the cloud. Note that a comparison cloud is not limited to just two individuals.

Getting ready

In order to create a comparison cloud, we will use the following two packages in R:

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required