Reader small image

You're reading from  Data Wrangling with R

Product typeBook
Published inFeb 2023
PublisherPackt
ISBN-139781803235400
Edition1st Edition
Concepts
Right arrow
Author (1)
Gustavo R Santos
Gustavo R Santos
author image
Gustavo R Santos

Gustavo R Santos has worked in the Technology Industry for 13 years, improving processes, and analyzing datasets and creating dashboards. Since 2020, he has been working as a Data Scientist in the retail industry, wrangling, analyzing, visualizing and modeling data with the most modern tools like R, Python and Databricks. Gustavo also gives lectures from time to time at an online school about Data Science concepts. He has a background in Marketing, is certified as Data Scientist by the Data Science Academy Brazil and pursues his specialist MBA in Data Science at the University of São Paulo
Read more about Gustavo R Santos

Right arrow

Creating word clouds in RStudio

A word cloud is very useful when we want to visualize the content of a text quickly. The more times a word is repeated within the text, the bigger it will be displayed on the word cloud, giving us a sense of what we can expect if we read the text. It is kind of a summary.

Once we have a dataset with words and their frequencies, plotting a word cloud takes just one line of code. The function is the same name as the library, wordcloud2(), and it takes as inputs the dataset, a color palette or a vector of colors, and the size of the words:

# Generating WordCloud
wordcloud2(data=word_freq, color="random-dark", size=1)

The result after running this code is printed as follows.

Figure 12.10 – Word cloud generated with the content from Chapter 10 of this book

Just to refresh our minds, Chapter 10 is about an introduction to the ggplot2 library. It brings the concepts of the grammar of graphics and introduces...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Data Wrangling with R
Published in: Feb 2023Publisher: PacktISBN-13: 9781803235400

Author (1)

author image
Gustavo R Santos

Gustavo R Santos has worked in the Technology Industry for 13 years, improving processes, and analyzing datasets and creating dashboards. Since 2020, he has been working as a Data Scientist in the retail industry, wrangling, analyzing, visualizing and modeling data with the most modern tools like R, Python and Databricks. Gustavo also gives lectures from time to time at an online school about Data Science concepts. He has a background in Marketing, is certified as Data Scientist by the Data Science Academy Brazil and pursues his specialist MBA in Data Science at the University of São Paulo
Read more about Gustavo R Santos