Creating word clouds with the wordcloud package

Word clouds are a nice and useful way to show text composition at a glance.

In a word cloud, words composing a text are composed in a kind of cloud, and usually their size and color is related to the frequency of the given term in the source text.

In this way, it is possible to understand quickly which words are more relevant to the given text. In this recipe, we will explore the Wikipedia page related to the R programming language.

Getting ready

We first need to install the required packages and load them into the R environment:

install.packages(c("wordcloud","RColorBrewer","rvest"))
library(wordcloud)
library(rvest)
library(RColorBrewer)

How to do it...

  1. Define your document URL and download it in the ...

Get RStudio for R Statistical Computing Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.