Making a wordcloud for for most common used words in a person’s tweet.
Load Twitter package, along with other necessary libraries.
#Instead of the traditional single package installation, we concactenate them into single code.
#install.packages(c("rtweet", #twitter package
# "tidytext", #text mining library
# "igraph", #plotting
# "ggraph")) #also plotting
#Concactenate the ncessary packages as well
lapply(c("rtweet", "tidytext", "igraph", "ggraph", "ggplot2", "dpylr"), require, character.only = TRUE)
## Loading required package: rtweet
## Warning: package 'rtweet' was built under R version 4.0.5
## Loading required package: tidytext
## Warning: package 'tidytext' was built under R version 4.0.5
## Loading required package: igraph
## Warning: package 'igraph' was built under R version 4.0.5
##
## Attaching package: 'igraph'
## The following objects are masked from 'package:stats':
##
## decompose, spectrum
## The following object is masked from 'package:base':
##
## union
## Loading required package: ggraph
## Warning: package 'ggraph' was built under R version 4.0.5
## Loading required package: ggplot2
## Loading required package: dpylr
## Warning in library(package, lib.loc = lib.loc, character.only = TRUE,
## logical.return = TRUE, : there is no package called 'dpylr'
## [[1]]
## [1] TRUE
##
## [[2]]
## [1] TRUE
##
## [[3]]
## [1] TRUE
##
## [[4]]
## [1] TRUE
##
## [[5]]
## [1] TRUE
##
## [[6]]
## [1] FALSE
#climateTweets <- search_tweets2(q = "Climatechange", n = 10000, lang = "en", include_rts = FALSE)