library(stringr)
library(rtweet)
library(httpuv)
library(dplyr)
library(ggplot2)
library(pacman)
library(tidytext)
library(tidyverse)
library(textdata)
library(ggpubr)
library(ggwordcloud)
library(knitr)
library(kableExtra)
I conducted a search of tweets utilizing the hashtag #covidvaccine. I include the 8,000 most recent tweets not including replies and removing retweets and limited to tweets in English.
I conducted this search to explore current discussions around the COVID-19 vaccine, including trust or distrust and overall sentiments about the impending implementation of a vaccine.
twts_vaccine <- search_tweets("#covidvaccine",
n = 8000,
include_rts = FALSE,
`-filter` = "replies",
lang = "en")
## Warning: Rate limit exceeded - 88
## Warning: Rate limit exceeded
Summary table
twts_vaccine %>%
select(screen_name, text, favorite_count) %>%
arrange(desc(favorite_count)) %>%
top_n(20) %>% kable(caption = "Summary of tweets by most favorited", col.names = c('Screen Name', 'Tweet', 'Favorited Count')) %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed"))
| Screen Name | Tweet | Favorited Count |
|---|---|---|
| ISayPorter | BREAKING: #CovidVaccine refrigerated-delivery contract worth £280 million awarded to ice cream man who once sold Matt Hancock a 99 with two Flakes. | 3068 |
| JenArnoldMD | I am ready & will get the #CovidVaccine as soon as I am eligible! As a high risk healthcare provider I am motivated to protect others & myself. I understand the science, know it’s safe & effective #COVID19 #besafe #CantWait #StopTheSpread https://t.co/srutSvZaP4 | 1493 |
| sapiofoxy | Funny how GPs couldn’t see you for months on end but now they’re willing to see you first thing in the morning for a vaccination 🙄❌❌❌ #GPs #NHS #Doctors #healthcare #CovidVaccine #COVID19 | 832 |
| OliviaTroye | #PeoplesVaccine Thank you #BidenHarris for caring about all Americans. And thank you @Alyssa_Milano for this thoughtful op-ed on the need to ensure access for all to the #CovidVaccine - https://t.co/lwG2UDzcJu https://t.co/4QFmu58e6U | 491 |
| PintSizedFarmer |
Just been on the phone to my hero GP brother who is working out how to give the #CovidVaccine to 7.5k patients. I said he needs a Sterimatic system plus sheep race. If he throws the empty vaccine bottles behind his head we reckon he could inject 100 people in one hour. #helpful https://t.co/wHb3jkiQCo |
489 |
| SupriyaShrinate | On @news24tvchannel at 7 pm #COVID19 #CovidVaccine | 361 |
| LNBDublin | We are told constantly that the virus doesn’t respect borders, that it doesn’t discriminate. However, sadly for the Palestinians, the Israeli Government does discriminate. The Irish Government must ensure Palestinians are included in the rollout of the vaccine. #CovidVaccine https://t.co/UUiXNyc8WK | 351 |
| jhalcrojohnston |
When you’re an SNP MP and actually sound a bit miffed that the UK is the first country to approve a #CovidVaccine Bit petty, @neilgraysnp. #ThankYouUK https://t.co/NY3p9UnVX3 |
329 |
| ndtv | "What Does PM Stand By’’: Rahul Gandhi On Centre’s Stand On #CovidVaccine https://t.co/mFqAaiJOkA https://t.co/gX96zQS1Yw | 311 |
| frankendodo |
So to the Leader of the House of Commons, and the Health Secretary we can now add the Universities Minister as lying about Brexit & the vaccine - they have not apologised, or deleted their tweets. How hugely concerning. #Covid19UK #CovidVaccine #Brexit https://t.co/SWOuynchzB https://t.co/cVATqiMJ6S |
310 |
| amyismall | Just booked my #CovidVaccine I for one don’t want to go through #covid hell all over again #longhaulers we are not immune to this - take it when offered | 291 |
| LVNancy |
3 former Presidents are willing to get #CovidVaccine on camera, in order to raise public confidence…. The same 3 responsible for Empowering #China 80% of active ingredients in medicines come from #China https://t.co/9mHqwJPHCF https://t.co/sCLXepUWEn |
266 |
| oCCultRebel |
NONE OF THEM Will take the Real #CovidVaccine All for show https://t.co/hYaHU9qibK |
263 |
| OffGuardian0 | Are you willing to risk “unknown fertility impacts” for a vaccine against a virus with 99.8% survival rate? #CovidVaccine #coronavirus https://t.co/6NRbsenpVM | 258 |
| mat_schmaltz | O’Toole and Sloan, making sure Canadians are confused as possible on #CovidVaccine. https://t.co/je6b4qtAJm | 255 |
| NicoleB_MD |
You know that moment when you’re so proud of your child you could just burst…I had one of those moments today 🥰 #CovidVaccine #VaccinesSaveLives @CincyChildrens @DrPaulOffit @DrToddWo https://t.co/M5uPZGFGeY |
240 |
| KrutikaKuppalli | I not only love that @BarackObama @BillClinton & #GeorgeBush said they will get the #CovidVaccine (on camera) when deemed safe BUT will do so AFTER administered to priority populations - emphasizing fair & equitable distribution of #vaccine. #leadership https://t.co/Q4ZlLjV1m4 | 224 |
| KiranKS |
Karnataka has identified 29,431 #CovidVaccine distribution centers. 10,008 staff identified. 2,855 cold storage centers established. About 1800 people getting vaccine for test purposes. Bengaluru, Shivamogga and Ballari districts will get test vaccines first. Fantastic prep! |
219 |
| arbab_jahangir | Discussion with Dr. Faisal Sultan on #Coronaviruspakistan #CovidVaccine #COVIDー19 #mdcat2020errors #Mdcatwasoutofsyllabus in #busbohathogaya with @arbab_jahangir https://t.co/790ej9LXIZ | 204 |
| mekarentaylor | Hairdresser telling me how she won’t be having the covid vaccine because you don’t know what’s in it with lips full of filler and a forehead full of Botox. #CovidVaccine | 185 |
Plot the timeline of recent #covidvaccine tweets
ts_plot(twts_vaccine, "hours") +
labs(x = "Date", y = "Number of Tweets",
title = "Frequency of tweets with a #covidvaccine hashtag",
subtitle = paste0(format(min(twts_vaccine$created_at), "%d %B %Y"), " to ", format(max(twts_vaccine$created_at),"%d %B %Y")),
caption = "Data collected from Twitter's API via rtweet") +
theme_minimal()
unique_tweets<-distinct(twts_vaccine, text, .keep_all = TRUE)
reg <- "([^A-Za-z\\d#@']|'(?![A-Za-z\\d#@]))"
vaccine_words <- unique_tweets %>% select(status_id, text) %>%
filter(!str_detect(text, '^"')) %>%
mutate(text = str_replace_all(text, "https://t.co/[A-Za-z\\d]+|&", "")) %>%
unnest_tokens(word, text, token = "regex", pattern = reg) %>%
filter(!word %in% stop_words$word,
str_detect(word, "[a-z]"))
vaccine_words %>% group_by(word) %>% summarize(n = n()) %>% arrange(desc(n)) %>% top_n(20)
## # A tibble: 20 x 2
## word n
## <chr> <int>
## 1 #covidvaccine 4912
## 2 vaccine 1578
## 3 #covid19 1176
## 4 #covid 1043
## 5 covid 714
## 6 people 489
## 7 #vaccine 358
## 8 vaccines 335
## 9 #coronavirus 294
## 10 uk 241
## 11 dr 240
## 12 news 189
## 13 #pfizer 179
## 14 health 161
## 15 safe 156
## 16 coronavirus 153
## 17 pfizer 151
## 18 line 148
## 19 government 147
## 20 vaccination 145
nrc <- get_sentiments("nrc") %>%
select(word, sentiment)
head(nrc)
## # A tibble: 6 x 2
## word sentiment
## <chr> <chr>
## 1 abacus trust
## 2 abandon fear
## 3 abandon negative
## 4 abandon sadness
## 5 abandoned anger
## 6 abandoned fear
vaccine_words_sentiments <- vaccine_words %>% inner_join(nrc, by = "word")
vaccine_words_sentiments %>% group_by(sentiment) %>% summarize(n = n()) %>% arrange(desc(n))
## # A tibble: 10 x 2
## sentiment n
## <chr> <int>
## 1 positive 6421
## 2 negative 3373
## 3 trust 3112
## 4 anticipation 2429
## 5 fear 2390
## 6 joy 1470
## 7 sadness 1468
## 8 anger 1415
## 9 surprise 934
## 10 disgust 918
Pie chart displaying sentiment counts
pie_words<- vaccine_words_sentiments %>%
group_by(sentiment) %>%
tally %>%
arrange(desc(n))
ggpubr::ggpie(pie_words, "n", label = "sentiment",
fill = "sentiment", color = "white",
palette = "Spectral")
The pie chart shows a range of sentiments around a pending COVID-19 vaccine as expected. Looking further into sentiments regionally and over time would be interesting when looking forward to vaccine roll-out.