Examining the Data
The purpose of examining the data is to find out what we can and cannot do with our data. Laying the options out makes it easier for us to find feasible avenues to continue our research! We pulled in data from QUID Monitor, a software that came free of charge (thanks to the University of South Carolina’s School of Journalism and Mass Communication!)
This data includes 63 columns of information, but only seven columns are particularly important.
Post ID
- includes a unique ID of each tweet
Post Type
- says whether the post is original, a retweet, or a reply
Followers
- number of Twitter followers
Published Date
- date of tweet/retweet
Author ID
- includes a unique ID of each author
Richness
- perceived rhetorical richness of a post
Sound Bite Text
- the post’s content
This is rather important to note because we do not have the number of interactions (likes, views, nor reposts) per tweet. So any analysis considering popularity would be based off of follower count.
Our example data from QUID has 63 columns and 49426 rows. Let’s take a look at it.
X01_17_24 %>% select("Post ID", "Post Type", "Followers/Daily Unique Visitors/Subscribers", "Published Date (GMT+00:00) London", "Author ID", "Richness", "Sound Bite Text") %>% head(10)
## # A tibble: 10 × 7
## `Post ID` `Post Type` Followers/Daily Uniq…¹ Published Date (GMT+…²
## <chr> <chr> <dbl> <chr>
## 1 1747394516909224011 Reposts 14 Jan 16, 2024 11:04:52…
## 2 1747388950623166729 Reposts 641 Jan 16, 2024 10:42:45…
## 3 1747362929178034577 Reposts 38 Jan 16, 2024 8:59:21 …
## 4 1747358324666888294 Reposts 1419 Jan 16, 2024 8:41:03 …
## 5 1747339453650079783 Reposts 522 Jan 16, 2024 7:26:04 …
## 6 1747453701055246698 Original 128688 Jan 17, 2024 3:00:03 …
## 7 1543316284909182976 Reposts 619 Jul 2, 2022 8:30:50 PM
## 8 1640683776916455426 Reposts 2261 Mar 28, 2023 12:54:29…
## 9 1369688254916661250 Reposts 75 Mar 10, 2021 4:35:02 …
## 10 1604875544906018828 Original 16 Dec 19, 2022 4:25:21 …
## # ℹ abbreviated names: ¹`Followers/Daily Unique Visitors/Subscribers`,
## # ²`Published Date (GMT+00:00) London`
## # ℹ 3 more variables: `Author ID` <chr>, Richness <dbl>,
## # `Sound Bite Text` <chr>
The data is quite clean, but we can perhaps give it a bit of shine.
Getting rid of reposts?
Clearly, there are many reposts and duplicates. Perhaps these are from viral tweets, as all of these tweets have a publishing dates within proximity to one another. We can get rid of some of these reposts. Also, there are some tweets that have tags (@username), which is not good for our sentiment analysis but could be useful for network analysis.
We can quantify this problem. Recall that perceived rhetorical
richness is measured in the Richness column. Our goal is to
find the rhetorical (or political) themes in posts. So, let’s use the
average richness and follow counts of each post type to
determine whether or not to keep reposts.
Clearly, the reposts have significantly more richness than the original tweets. It is possible that Twitter works in such a way that users who repost a topic are better able to rhetorically frame their stances on issues. As a result, it seems that removing reposts would remove quite a bit of richness from our dataset! Additionally, there are 8 times more reposts than original replies. It would be better advised to remove replies and comments rather than reposts. Arguably, the lack of richness could be due to the derogatory nature of such comments and could still lend itself to thematic analysis. But it does seem that reposts will contain more… realistic content than replies or original posts.
Also, note that reposters often have more followers than the original posts. Dr. Kitzie may know more about this, but this smells of virile misinformation.
Collecting more information than meets the eye?
So let’s do some cleaning. First, we’ll get rid of replies and comments. Then, we can remove any tweet which has duplicated content. We can see that there are hashtags in the Sound Bite Text as well as some username text. Let’s take that. That’s data that we could use to do find out what’s trending.
#Selects dataset and the seven most important columns.
X01_17_24 %>%
select("Post ID", "Post Type", "Followers/Daily Unique Visitors/Subscribers", "Published Date (GMT+00:00) London", "Author ID", "Richness", "Sound Bite Text") %>%
filter(`Post Type` != "Replies and Comments") %>% #exclude replies
distinct(`Sound Bite Text`, .keep_all = TRUE) #remove duplicates
## # A tibble: 22,516 × 7
## `Post ID` `Post Type` Followers/Daily Uniq…¹ Published Date (GMT+…²
## <chr> <chr> <dbl> <chr>
## 1 1747394516909224011 Reposts 14 Jan 16, 2024 11:04:52…
## 2 1747453701055246698 Original 128688 Jan 17, 2024 3:00:03 …
## 3 1543316284909182976 Reposts 619 Jul 2, 2022 8:30:50 PM
## 4 1640683776916455426 Reposts 2261 Mar 28, 2023 12:54:29…
## 5 1369688254916661250 Reposts 75 Mar 10, 2021 4:35:02 …
## 6 1604875544906018828 Original 16 Dec 19, 2022 4:25:21 …
## 7 1513575205054128135 Reposts 46 Apr 11, 2022 6:50:24 …
## 8 1672921345955340288 Reposts 75 Jun 25, 2023 11:55:04…
## 9 1641203121941626882 Reposts 1443 Mar 29, 2023 11:18:11…
## 10 1636834458635493376 Reposts 199 Mar 17, 2023 8:58:40 …
## # ℹ 22,506 more rows
## # ℹ abbreviated names: ¹`Followers/Daily Unique Visitors/Subscribers`,
## # ²`Published Date (GMT+00:00) London`
## # ℹ 3 more variables: `Author ID` <chr>, Richness <dbl>,
## # `Sound Bite Text` <chr>
#Uses regex expressions to extract hashtags and tags.
df_hashtags = X01_17_24 %>%
filter(`Post Type` != "Replies and Comments") %>%
select("Sound Bite Text") %>%
distinct(`Sound Bite Text`, .keep_all = FALSE) %>%
str_extract_all("(?<!\\w)#[A-Z]\\S{1,49}(?!\\w)") %>% #extract hashtag regex
unlist() #remove list format and convert to character vector
df_tags = X01_17_24 %>%
filter(`Post Type` != "Replies and Comments") %>%
select("Sound Bite Text") %>%
distinct(`Sound Bite Text`, .keep_all = FALSE) %>%
str_extract_all("(?<!\\w)@[A-Z]\\S{1,49}(?!\\w)") %>% #extract tag regex
unlist() #remove list format and convert to character vector
table(df_hashtags) %>% sort(decreasing = TRUE) %>% head(15)
## df_hashtags
## #DemVoice1 #ChildrenOfTigray #WorldChildrensDay
## 194 140 129
## #BannedBooksWeek #UniteAgainstBookBans #WhatsHappeningInMyanmar
## 101 89 80
## #HumanRightsViolations #ONEV1 #FreshResists
## 63 59 57
## #LGBTQ #VoteBlue #Fresh
## 51 50 46
## #ProudBlue #Florida #BannedBooks
## 46 45 44
table(df_tags) %>% sort(decreasing = TRUE) %>% head(15)
## df_tags
## @UN @UNICEF @GovRonDeSantis @PENamerica:
## 175 131 110 87
## @GOP @POTUS @Misty_E_Griffin: @ALALibrary:
## 78 68 67 65
## @TonyHussein4: @ChristinaPushaw: @FoxNews: @UN_HRC
## 64 59 59 59
## @Moms4Liberty @PENamerica @VP
## 57 57 51
We can see that "SaveMyanmarChildren" and
"ChildrenofTigray" are trending quite strongly in this
selected dataset. Likely, we’ll have to remove these specific
hashtags by fine-tuning our QUID selection strategy and removing search
results about Ethiopia, Tigray, and the current atrocities going on in
the region.
For the tagged users that are most likely to appear, we can see that @UN, @UNICEF, and @GovRonDeSantis appear extremely often. There are a number of key players that we expected to see here too, such as @ErinInTheMorn and @ALALibrary.
Wordclouds
Now that we have an idea of what kind of tags and hashtags are occurring, it’s a good idea to look at what kind of words are most likely to appear in non-duplicated tweets and retweets. We can create a function to examine that data. We can also create a visualization to understand what words are most common. This at least gives us an idea on whether our sound bites are in the realm of our research question.
#Separates words and filters out stopwords to create a frequency table.
tweets_words <- X01_17_24 %>%
filter(`Post Type` != "Replies and Comments") %>%
select(`Sound Bite Text`) %>%
unnest_tokens(word, `Sound Bite Text`) #separating each word in the tweet
words <- tweets_words %>%
count(word, sort=TRUE) %>% #creating a frequency table which tallies up the appeareance of each word in the tweet
filter(!word %in% append(stopwords(), c("rt", "pic.twitter.com"))) #filter to remove stopwords (e.g. "the", "a", "i")
words
## # A tibble: 59,050 × 2
## word n
## <chr> <int>
## 1 books 20817
## 2 rights 14055
## 3 book 12951
## 4 banning 11552
## 5 ban 9910
## 6 banned 7213
## 7 school 6434
## 8 children 6148
## 9 right 5863
## 10 parents 5412
## # ℹ 59,040 more rows
set.seed(300)
wordcloud2(data=words, size=1.6, color='random-light', backgroundColor="black")
This looks about right! The most common word in the dataset is
book followed by rights and ban.
(Which is no surprise since we pruned the list based on these
words).