Week 32: Bob Ross Painting

After a few weeks being absent from Tidy Tuesday i thought of coming back with a word cloud.

Bob Ross Painting titles most frequent words

The code below was used to generate the word cloud:

# Load the libraries
library(tidytext)
library(tidyverse)
library(wordcloud)

# Import data

bob_ross <- readr::read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-08-06/bob-ross.csv")

# Bit of cleaning data

bob_ross %>% select(TITLE) -> bob
bob %>% unnest_tokens(word, TITLE) %>% anti_join(stop_words)-> cl
cl %>% count(word, sort = TRUE)-> cl

#generate the word cloud using the data:

layout(matrix(c(1, 2), nrow=2), heights=c(1, 4))
par(mar=rep(0, 4))
plot.new()
text(x=0.5, y=0.5, "Most Frequent words in Bob Ross Title")
wordcloud(words = cl$word, freq = cl$n, min.freq = 1,
          max.words=200, random.order=FALSE, rot.per=0.35, 
          colors=brewer.pal(8, "Accent"))

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

WordPress.com.

Up ↑

%d bloggers like this: