Load Packages

library(rtweet)
library(socsci)
## Loading required package: tidyverse
## -- Attaching packages ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- tidyverse 1.2.1 --
## v ggplot2 3.0.0     v purrr   0.2.5
## v tibble  1.4.2     v dplyr   0.7.6
## v tidyr   0.8.1     v stringr 1.3.1
## v readr   1.1.1     v forcats 0.3.0
## -- Conflicts -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- tidyverse_conflicts() --
## x dplyr::filter()  masks stats::filter()
## x purrr::flatten() masks rtweet::flatten()
## x dplyr::lag()     masks stats::lag()
## Loading required package: rlang
## 
## Attaching package: 'rlang'
## The following objects are masked from 'package:purrr':
## 
##     %@%, %||%, as_function, flatten, flatten_chr, flatten_dbl,
##     flatten_int, flatten_lgl, invoke, list_along, modify, prepend,
##     rep_along, splice
## The following object is masked from 'package:rtweet':
## 
##     flatten
## Loading required package: scales
## 
## Attaching package: 'scales'
## The following object is masked from 'package:purrr':
## 
##     discard
## The following object is masked from 'package:readr':
## 
##     col_factor
## Loading required package: broom
## Loading required package: glue
## 
## Attaching package: 'glue'
## The following object is masked from 'package:dplyr':
## 
##     collapse
library(tidytext)
library(wordcloud)
## Loading required package: RColorBrewer

Grab Some Tweets

tweets <- search_tweets("#rstats", n = 500, include_rts = FALSE)
## Searching for tweets...
## Finished collecting tweets!

Tokenize Tweets

tidy <- tweets %>% 
  unnest_tokens(word,text)

Make a WordCloud

tidy %>% 
  count(word) %>% 
  with(wordcloud(word, n, max.words = 100))
## Warning: The `printer` argument is soft-deprecated as of rlang 0.3.0.
## This warning is displayed once per session.