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

WordPress.com.

Up ↑

%d bloggers like this: