Attaching package: 'plotly'
The following object is masked from 'package:ggplot2':
last_plot
The following object is masked from 'package:stats':
filter
The following object is masked from 'package:graphics':
layout
Next, downloaded all of the speeches from the 2020 Democratic Convention.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: "^"
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
For the first analysis, I found the most common words spoken by both parties. Usually, the most common words in any text would be “and”, “or”, “but”, etc. To stop these from being considered as “words”, I added in the function “anti_join(stop_words)”. This function removed these words from the table
# A tibble: 2,677 × 2
word n
<chr> <int>
1 joe 118
2 president 95
3 america 86
4 people 74
5 country 68
6 biden 58
7 nation 52
8 vote 46
9 trump 43
10 americans 38
# ℹ 2,667 more rows
# A tibble: 4,603 × 2
word n
<chr> <int>
1 president 315
2 trump 215
3 america 214
4 american 173
5 country 164
6 people 164
7 biden 139
8 joe 104
9 americans 90
10 time 84
# ℹ 4,593 more rows
Next, I wanted to graph the ten most common words said by each party. To do so, I set a head count of 10.
Top 10 Democratic Convention Words
dem2020 |>anti_join(stop_words) |>count(word, Party, sort =TRUE) |>arrange(desc(n)) |>head(10) |>ggplot(aes(reorder(word, n), n, fill = Party)) +geom_col() +coord_flip() +scale_fill_manual(values =c('blue')) +theme_clean() +ggtitle("Top 10 Words of 2020 Democratic Convention") +labs(y="Count", x ="Word")
Joining with `by = join_by(word)`
The top ten words of the Democratic Convention encompass the central idea of promoting Joe Biden for presidency. It makes sense that “Trump” would be among the top words, as that was his running mate at the time.
Top 10 Republican Convention Words
rep2020 |>anti_join(stop_words) |>count(word, Party, sort =TRUE) |>arrange(desc(n)) |>head(10) |>ggplot(aes(reorder(word, n), n, fill = Party)) +geom_col() +coord_flip() +scale_fill_manual(values =c('red')) +theme_clean() +ggtitle("Top 10 Words of 2020 Republican Convention") +labs(y="Count", x ="Word")
Joining with `by = join_by(word)`
The top ten words of the Republican Convention makes sense, as at this time Trump was the incumbent.
Common words among both parties were “America”, “country”, and “people”. It could be assumed that these words would be used as a “call-to-action” for many people- encouraging them to vote when the time comes.
Observation 2
Secondly, I wanted to create an easily conceptualized visual that encapsulated the most common words of each convention. To do that, I created a word cloud. For this function, I specifically used the “wordcloud2” package. Similar to the observation made previously, I removed all stop words for a closer look at the main ideas of both conventions.
Third, I calculated the mean of both conventions. This was to measure the overall positivity or negativity of both Democrats and republicans. To find the mean, I used the function of ‘afinn’ and implemented sentiments.
The mean value of the 2020 Republican Convention was 0.23.
Overall, the Republican Convention was more positive when compared the the Democratic Convention. However, they were only 0.14 points apart. Because of such a slim margin, it can be assumed that both parties had a similar tone amongst all speeches.
Observation 4
I will be measuring the sentiment of each parties convention. Sentiments measure positivity or negativity from speech. By using this function, it analyzes the most common words and gives them a positive or negative value. The “n” value seen in the charts below encompasses the amount of times the word was spoken.
Joining with `by = join_by(word)`
Joining with `by = join_by(word)`
value
word
n
1
united
51
1
god
50
2
freedom
42
3
love
42
-1
fight
40
2
heroes
39
2
proud
35
2
support
31
2
opportunity
30
-2
war
28
1
dream
28
1
safe
26
Similar to the Democratic Convention, “love” was the most positive word of the Republican Convention. The Republican Convention had far less negative words. Their most negative word was scored at a -2, which was “war”.
Observation 5
Lastly, I wanted to see how the two parties compare to each other in terms of sentiments. For this to be accomplished, I merged both convention data sets.
convention2020 <-rbind(dem2020, rep2020)
Next, I graphed the sentiments from both parties. I believe that by graphing them together, it can easily be conceptualized by a larger audience.
Joining with `by = join_by(word)`
Joining with `by = join_by(word)`
Related to the results previously, the 2020 Republican Convention was overall more positive when compared to the Democratic Convention. On this chart, the Republican party doubled the Democratic party in sentiment value.
Conclusion
Overall, the Republican Convention of 2020 was a more positive event. The Republican Party scored higher in overall positivity in specific words used, and the sentiment of all speeches combined. The Democratic Convention was a close runner up in terms of sentiment, but used more negative words, according to the function “afinn”. Both parties encapsulated promoting their candidate, while supporting the idea of bettering America.