An analysis of…

This analysis of the pop’s twitter timeline focuses on .. wikipedia.

First, we need to load our packages:

library(rtweet)
library(tidyverse)
library(tidytext)
library(rtweet)
library(wordcloud2)

Now, let’s get the Pope’s timeline:

  gates <- get_timeline('billgates', n = 3200)

The next step is to remove stop words and count word frequency. We’ll remove the extra words ‘t.co,’ ‘http,’ etc., and generate a wordcloud

gates %>% 
  unnest_tokens(word, text) %>% 
  anti_join(stop_words) %>% 
  filter(!word %in% c('t.co', 'https', 'http', 'amp')) %>% 
  count(word, sort = TRUE) %>% 
  head(20) %>% 
  knitr::kable()
## Joining, by = "word"
word n
world 318
people 268
i’m 218
progress 174
lives 167
health 160
change 152
polio 152
book 149
fight 144
energy 143
global 140
climate 138
it’s 132
here’s 125
read 124
time 113
life 111
malaria 101
students 99
gates %>% 
  unnest_tokens(word, text) %>% 
  anti_join(stop_words) %>% 
  filter(!word %in% c('t.co', 'https', 'http', 'amp')) %>% 
  count(word, sort = TRUE) %>% 
  wordcloud2()
## Joining, by = "word"