An analysis of…

This analysis of the pop’s twitter timeline focuses on …. wikipedia: http://rmarkdown.rstudio.com.

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
polio 152
change 151
book 148
energy 143
fight 143
global 140
climate 137
it’s 132
here’s 124
read 124
time 112
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"