For this project I decided to analyze Joe Biden’s inauguration speech. I will be looking at his top ten most used words, the most and least positive words he uses, and a word cloud.
library(tidytext)
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.3 ✓ purrr 0.3.4
## ✓ tibble 3.1.0 ✓ dplyr 1.0.6
## ✓ tidyr 1.1.3 ✓ stringr 1.4.0
## ✓ readr 1.4.0 ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(readr)
library(textdata)
library(ggplot2)
library(stringr)
library(wordcloud2)
BidenSpeech <- read_csv ('BidenSpeech.txt', col_names = FALSE)
##
## ── Column specification ────────────────────────────────────────────────────────
## cols(
## X1 = col_character()
## )
## Warning: 73 parsing failures.
## row col expected actual file
## 2 -- 1 columns 8 columns 'BidenSpeech.txt'
## 8 -- 1 columns 4 columns 'BidenSpeech.txt'
## 12 -- 1 columns 3 columns 'BidenSpeech.txt'
## 13 -- 1 columns 6 columns 'BidenSpeech.txt'
## 14 -- 1 columns 3 columns 'BidenSpeech.txt'
## ... ... ......... ......... .................
## See problems(...) for more details.
BidenSpeech %>%
unnest_tokens(word, X1) -> biden_words
biden_words %>%
anti_join(stop_words) -> Biden_words2
## Joining, by = "word"
View(Biden_words2)
Biden_words2 %>%
count(word, sort = TRUE) %>%
arrange(desc(n)) %>%
head(10) %>%
ggplot(aes(reorder(word, n), n)) + geom_col() +
coord_flip()
Biden’s most used words follow the ideas of many of the past presidents’ inauguration speeches. Most inauguration speeches emphasize the need for unity and standing together as one nation. Biden’s most used word is “America,” which makes sense given that most inauguration speeches not only reflect on America’s past but its future as well. The use of the words like nation, unity, and democracy gives off a sense of hope and union for the next four years Biden will be in office.
Biden_words2 %>%
count(word) %>%
inner_join(get_sentiments('afinn')) -> biden_words2_afinn
## Joining, by = "word"
biden_words2_afinn %>%
arrange(desc(value))%>%
head(10) %>%
ggplot(aes(word, value)) + geom_col()
Biden’s most positive words emphasize his optimistic hope for the future of America. Words like inspire, hope, justice, and honor invoke traditional American values. After a year of COVID-19, racial tensions, and an insurrection at the capitol, Biden’s positive words work to reassure a troubled nation that there is still hope for love and joy in that nation’s future.
biden_words2_afinn %>%
arrange(desc(-value))%>%
head(10) %>%
ggplot(aes(word, value)) + geom_col()
Biden’s most negative words likely come from his reflection on the adversities America has recently faced. With problems such as a national pandemic and extreme race tensions, it is logical that Biden used words like anger, fear, crisis, and racism to describe America’s status. Words like desperate, lost, and destroying also make sense given the chaotic period of internal conflict America has been experiencing.
Biden_words2 %>%
count(word, sort = TRUE) %>%
filter(!word %in% c('ii', '400')) %>%
wordcloud2()
Lastly, I created a word cloud to visualize Biden’s most used words in his speech. Words like crisis and virus highlight the past year. Biden also uses words like nation, story, and children to remind Americans about the legacy we create as a nation. Overall, Biden’s speech gives a hopeful and optimistic message to Americans that America will prevail.