knitr::opts_chunk$set(echo = TRUE, 
                      message = F, 
                      warning = F)
library(tidyverse)
library(here)
library(RColorBrewer)
library(janitor)
library(psych)
library(ggtext)
library(knitr)
library(kableExtra)
library(forcats)
library(gtools)
library(ggrepel)
library(DT)
library(papeR)
library(compareGroups)
library(ggcorrplot)
df_full = read.csv("Share_Your_Voice_2023_01_11_19_08_50.csv")
df_retarget = df_full %>% 
  filter(pilot_version == 'retarget_pilot_regular_ads')

Summary Statistics Tables

Who do they trust?

Question: On a scale from 1 to 5, how much would you say you trust the follwing people or organizations to give you good information about the vaccine?

df_retarget = 
  df_retarget %>%
  mutate(
    vax_status_retarget = case_when(
      num_dose == "0" ~ 0,
      num_dose %in% c("1", "2", "3") ~ 1
    ),
    vax_status_retarget_4 = case_when(
      num_dose == "0" ~ 0,
      num_dose == "1" ~ 1,
      num_dose == "2" ~ 2,
      num_dose == "3" ~ 3
    )
  )

df_retarget$vax_status_retarget = factor(df_retarget$vax_status_retarget, levels = c(0, 1))
df_retarget$vax_status_retarget_4 = factor(df_retarget$vax_status_retarget_4, levels = c(0,1,2,3))

df_retarget$country_answer[!df_retarget$country_answer %in% c("South Africa","Kenya","Nigeria","Ghana")] = NA
df_retarget$country_answer = factor(df_retarget$country_answer, levels = c("South Africa","Kenya","Nigeria","Ghana"))
df_retarget = df_retarget %>% filter(!is.na(country_answer))
## clean data
df_retarget$doctor[!df_retarget$doctor %in% c("1","2","3","4","5")] = NA
df_retarget$doctor = strtoi(df_retarget$doctor)
df_retarget$family[!df_retarget$family %in% c("1","2","3","4","5")] = NA
df_retarget$family = strtoi(df_retarget$family)
df_retarget$friends[!df_retarget$friends %in% c("1","2","3","4","5")] = NA
df_retarget$friends = strtoi(df_retarget$friends)
df_retarget$minister_religious_leader[!df_retarget$minister_religious_leader %in% c("1","2","3","4","5")] = NA
df_retarget$minister_religious_leader = strtoi(df_retarget$minister_religious_leader)
df_retarget$community_leader[!df_retarget$community_leader %in% c("1","2","3","4","5")] = NA
df_retarget$community_leader = strtoi(df_retarget$community_leader)

df_retarget$clinic_worker[!df_retarget$clinic_worker %in% c("1","2","3","4","5")] = NA
df_retarget$clinic_worker = strtoi(df_retarget$clinic_worker)
df_retarget$community_based_org[!df_retarget$community_based_org %in% c("1","2","3","4","5")] = NA
df_retarget$community_based_org = strtoi(df_retarget$community_based_org)
df_retarget$health_department[!df_retarget$health_department %in% c("1","2","3","4","5")] = NA
df_retarget$health_department = strtoi(df_retarget$health_department)
df_retarget$WHO[!df_retarget$WHO %in% c("1","2","3","4","5")] = NA
df_retarget$WHO = strtoi(df_retarget$WHO)
df_retarget$african_scientist[!df_retarget$african_scientist %in% c("1","2","3","4","5")] = NA
df_retarget$african_scientist = strtoi(df_retarget$african_scientist)
df_retarget$international_scientist[!df_retarget$international_scientist %in% c("1","2","3","4","5")] = NA
df_retarget$international_scientist = strtoi(df_retarget$international_scientist)
df_retarget$international_ngo[!df_retarget$international_ngo %in% c("1","2","3","4","5")] = NA
df_retarget$international_ngo = strtoi(df_retarget$international_ngo)
df_retarget$local_news_media[!df_retarget$local_news_media %in% c("1","2","3","4","5")] = NA
df_retarget$local_news_media = strtoi(df_retarget$local_news_media)
df_retarget$international_news_media[!df_retarget$international_news_media %in% c("1","2","3","4","5")] = NA
df_retarget$international_news_media = strtoi(df_retarget$international_news_media)

Summary Statistics

df_retarget %>%
  #select_if(is.numeric) %>%
  select(doctor, family, friends, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo, `Local News/Media` = local_news_media, `International News/Media` = international_news_media) %>%
  describe(quant = c(.25,.75) ) %>%
  select(n, mean, sd, se, min, min, first_quartile = Q0.25, median, third_quartile = Q0.75, max) %>%
  clean_names(case = "title") %>%
  rename(SD = Sd, SE = Se) %>%
  kable(caption = "Summary Statistics for 'Who do they trust'", digits = 3)%>%
  kable_styling(bootstrap_options = c("striped", "hover"))
Summary Statistics for ‘Who do they trust’
N Mean SD SE Min First Quartile Median Third Quartile Max
doctor 1602 3.721 1.443 0.036 1 3 4 5 5
family 1580 3.175 1.482 0.037 1 2 3 5 5
friends 1568 2.416 1.300 0.033 1 1 2 3 5
Ministers/Religious Leaders 1561 2.689 1.442 0.036 1 1 3 4 5
Community Leaders 1553 2.459 1.336 0.034 1 1 2 3 5
Local Health Clinic Worker 1544 3.498 1.384 0.035 1 2 4 5 5
Community-Based Organizations 1531 2.937 1.370 0.035 1 2 3 4 5
Department of Health 1526 3.635 1.504 0.039 1 2 4 5 5
WHO 1521 3.862 1.492 0.038 1 3 5 5 5
African scientists 1517 3.178 1.457 0.037 1 2 3 5 5
International Scientists 1509 3.318 1.486 0.038 1 2 4 5 5
International NGOs 1500 3.096 1.394 0.036 1 2 3 4 5
Local News/Media 1496 2.721 1.381 0.036 1 1 3 4 5
International News/Media 1493 2.903 1.388 0.036 1 2 3 4 5

Summary Statistics by Vaccination Status

df_retarget %>%
  select(vax_status_retarget, doctor, family, friends, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo, `Local News/Media` = local_news_media, `International News/Media` = international_news_media) %>% 
  split(.$vax_status_retarget) %>% 
  map(describe) %>% 
  do.call(rbind, .) %>%
  data.frame() %>%
  select(n, mean , se) %>%
  rownames_to_column() %>%
  separate(rowname, c("vax_status_retarget", "variable"), sep = "\\.") %>%
  filter(variable != "vax_status_retarget*") %>%
  pivot_longer(cols = c("n", "mean", "se")) %>%
  mutate(column = paste(vax_status_retarget, name, sep = "_")) %>%
  select(column, variable, value) %>%
  pivot_wider(names_from = column) %>%
  kable(digits = 3,caption = "Summary Statistics for Trust Variables by Vaccination Status", 
        col.names = c("", "N", "Mean", "SE", "N", "Mean", "SE")) %>%
  kable_styling(bootstrap_options = c("striped", "hover"))%>%
  add_header_above(c(" " = 1, "Unvaccinated" = 3, "Vaccinated" = 3))
Summary Statistics for Trust Variables by Vaccination Status
Unvaccinated
Vaccinated
N Mean SE N Mean SE
doctor 291 3.629 0.079 795 4.020 0.045
family 292 3.192 0.085 795 3.360 0.051
friends 292 2.226 0.068 795 2.600 0.046
Ministers/Religious Leaders 292 2.705 0.084 795 2.808 0.050
Community Leaders 292 2.260 0.074 795 2.605 0.046
Local Health Clinic Worker 292 3.134 0.076 795 3.845 0.044
Community-Based Organizations 292 2.760 0.071 795 3.157 0.047
Department of Health 292 3.295 0.088 795 3.980 0.047
WHO 292 3.767 0.085 795 4.169 0.046
African scientists 292 3.075 0.078 795 3.459 0.049
International Scientists 292 3.188 0.082 795 3.628 0.049
International NGOs 291 2.993 0.078 795 3.316 0.048
Local News/Media 292 2.455 0.073 795 2.923 0.048
International News/Media 292 2.723 0.075 795 3.116 0.049

Summary Statistics by Vaccination Dose

df_retarget %>%
  select(vax_status_retarget_4, doctor, family, friends, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo, `Local News/Media` = local_news_media, `International News/Media` = international_news_media) %>% 
  split(.$vax_status_retarget_4) %>% 
  map(describe) %>% 
  do.call(rbind, .) %>%
  data.frame() %>%
  select(n, mean , se) %>%
  rownames_to_column() %>%
  separate(rowname, c("vax_status_retarget_4", "variable"), sep = "\\.") %>%
  filter(variable != "vax_status_retarget_4*") %>%
  pivot_longer(cols = c("n", "mean", "se")) %>%
  mutate(column = paste(vax_status_retarget_4, name, sep = "_")) %>%
  select(column, variable, value) %>%
  pivot_wider(names_from = column) %>%
  kable(digits = 3,caption = "Summary Statistics for Trust Variables by Vaccination Dose", 
        col.names = c("", "N", "Mean", "SE", "N", "Mean", "SE", "N", "Mean", "SE", "N", "Mean", "SE")) %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  add_header_above(c(" " = 1, "Unvaccinated" = 3, "1 dose" = 3, "2 doses" = 3, "3 doses" = 3))
Summary Statistics for Trust Variables by Vaccination Dose
Unvaccinated
1 dose
2 doses
3 doses
N Mean SE N Mean SE N Mean SE N Mean SE
doctor 291 3.629 0.079 231 4.026 0.079 376 4.008 0.066 188 4.037 0.095
family 292 3.192 0.085 231 3.281 0.094 376 3.410 0.072 188 3.356 0.110
friends 292 2.226 0.068 231 2.502 0.082 376 2.598 0.066 188 2.723 0.102
Ministers/Religious Leaders 292 2.705 0.084 231 2.740 0.091 376 2.819 0.074 188 2.867 0.102
Community Leaders 292 2.260 0.074 231 2.481 0.083 376 2.646 0.068 188 2.676 0.099
Local Health Clinic Worker 292 3.134 0.076 231 3.684 0.084 376 3.949 0.059 188 3.835 0.096
Community-Based Organizations 292 2.760 0.071 231 3.039 0.086 376 3.279 0.068 188 3.059 0.100
Department of Health 292 3.295 0.088 231 3.913 0.089 376 4.045 0.065 188 3.931 0.103
WHO 292 3.767 0.085 231 4.091 0.088 376 4.269 0.063 188 4.064 0.102
African scientists 292 3.075 0.078 231 3.424 0.094 376 3.503 0.069 188 3.415 0.102
International Scientists 292 3.188 0.082 231 3.662 0.090 376 3.662 0.069 188 3.516 0.108
International NGOs 291 2.993 0.078 231 3.234 0.089 376 3.465 0.065 188 3.117 0.106
Local News/Media 292 2.455 0.073 231 2.779 0.091 376 3.029 0.069 188 2.888 0.102
International News/Media 292 2.723 0.075 231 3.017 0.090 376 3.184 0.071 188 3.101 0.101

Summary Statistics by Country

df_retarget %>%
  select(country_answer, doctor, family, friends, `Ministers/Religious Leaders` = minister_religious_leader, `Community Leaders` = community_leader, `Local Health Clinic Worker` = clinic_worker, `Community-Based Organizations` = community_based_org, `Department of Health` = health_department, WHO, `African scientists` = african_scientist, `International Scientists` = international_scientist, `International NGOs` = international_ngo, `Local News/Media` = local_news_media, `International News/Media` = international_news_media) %>% 
  split(.$country_answer) %>% 
  map(describe) %>% 
  do.call(rbind, .) %>%
  data.frame() %>%
  select(n, mean , se) %>%
  rownames_to_column() %>%
  separate(rowname, c("country_answer", "variable"), sep = "\\.") %>%
  filter(variable != "country_answer*") %>%
  pivot_longer(cols = c("n", "mean", "se")) %>%
  mutate(column = paste(country_answer, name, sep = "_")) %>%
  select(column, variable, value) %>%
  pivot_wider(names_from = column) %>%
  kable(digits = 3,caption = "Summary Statistics for Trust Variables by Country", 
        col.names = c("", "N", "Mean", "SE", "N", "Mean", "SE", "N", "Mean", "SE", "N", "Mean", "SE")) %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  add_header_above(c(" " = 1, "South Africa" = 3, "Kenya" = 3, "Nigeria" = 3, "Ghana" = 3))
Summary Statistics for Trust Variables by Country
South Africa
Kenya
Nigeria
Ghana
N Mean SE N Mean SE N Mean SE N Mean SE
doctor 435 3.667 0.073 408 3.652 0.075 334 3.793 0.075 425 3.786 0.066
family 429 3.086 0.074 405 3.264 0.071 331 3.387 0.080 415 3.010 0.073
friends 423 2.156 0.061 404 2.522 0.064 329 2.581 0.069 412 2.447 0.066
Ministers/Religious Leaders 421 2.373 0.069 403 2.826 0.070 328 2.963 0.077 409 2.658 0.074
Community Leaders 418 2.165 0.064 402 2.724 0.064 326 2.442 0.074 407 2.514 0.068
Local Health Clinic Worker 417 3.585 0.070 402 3.557 0.068 324 3.373 0.076 401 3.449 0.069
Community-Based Organizations 414 2.819 0.069 401 3.182 0.068 320 2.878 0.073 396 2.861 0.068
Department of Health 411 3.545 0.078 401 3.626 0.073 320 3.747 0.082 394 3.647 0.075
WHO 409 3.592 0.081 400 3.902 0.072 319 4.163 0.073 393 3.858 0.075
African scientists 409 3.042 0.078 399 3.043 0.070 317 3.334 0.079 392 3.332 0.071
International Scientists 407 2.943 0.076 399 3.328 0.072 314 3.640 0.078 389 3.440 0.075
International NGOs 404 2.703 0.070 398 3.234 0.070 313 3.383 0.072 385 3.132 0.071
Local News/Media 401 2.476 0.070 397 2.844 0.069 312 2.753 0.076 386 2.821 0.070
International News/Media 399 2.536 0.068 396 3.008 0.069 312 3.106 0.076 386 3.010 0.071
  • This table also located here

Sorting Questions

Questions: Tell me more about what YOU believe by telling me how much you agree or disagree with the statements you’re about to read.

  • 1 = I Disagree Strongly
  • 2 = I Disagree
  • 3 = I’m Unsure
  • 4 = I Agree
  • 5 = I Agree Strongly
## clean data
df_retarget$covid_is_a_problem[!df_retarget$covid_is_a_problem %in% c("1","2","3","4","5")] = NA
df_retarget$covid_is_a_problem = strtoi(df_retarget$covid_is_a_problem)
df_retarget$covid_is_problem_my_country[!df_retarget$covid_is_problem_my_country %in% c("1","2","3","4","5")] = NA
df_retarget$covid_is_problem_my_country = strtoi(df_retarget$covid_is_problem_my_country)
df_retarget$vax_is_safe[!df_retarget$vax_is_safe %in% c("1","2","3","4","5")] = NA
df_retarget$vax_is_safe = strtoi(df_retarget$vax_is_safe)
df_retarget$vax_prevent_sick_death[!df_retarget$vax_prevent_sick_death %in% c("1","2","3","4","5")] = NA
df_retarget$vax_prevent_sick_death = strtoi(df_retarget$vax_prevent_sick_death)
df_retarget$need_vax_for_protection[!df_retarget$need_vax_for_protection %in% c("1","2","3","4","5")] = NA
df_retarget$need_vax_for_protection = strtoi(df_retarget$need_vax_for_protection)
df_retarget$vax_safer_covid[!df_retarget$vax_safer_covid %in% c("1","2","3","4","5")] = NA
df_retarget$vax_safer_covid = strtoi(df_retarget$vax_safer_covid)
df_retarget$developer_want_to_help[!df_retarget$developer_want_to_help %in% c("1","2","3","4","5")] = NA
df_retarget$developer_want_to_help = strtoi(df_retarget$developer_want_to_help)
df_retarget$health_worker_want_to_help[!df_retarget$health_worker_want_to_help %in% c("1","2","3","4","5")] = NA
df_retarget$health_worker_want_to_help = strtoi(df_retarget$health_worker_want_to_help)
df_retarget$gov_want_to_help[!df_retarget$gov_want_to_help %in% c("1","2","3","4","5")] = NA
df_retarget$gov_want_to_help = strtoi(df_retarget$gov_want_to_help)
df_retarget$important_to_protect_myself[!df_retarget$important_to_protect_myself %in% c("1","2","3","4","5")] = NA
df_retarget$important_to_protect_myself = strtoi(df_retarget$important_to_protect_myself)
df_retarget$important_to_protect_other[!df_retarget$important_to_protect_other %in% c("1","2","3","4","5")] = NA
df_retarget$important_to_protect_other = strtoi(df_retarget$important_to_protect_other)
df_retarget$vax_moral[!df_retarget$vax_moral %in% c("1","2","3","4","5")] = NA
df_retarget$vax_moral = strtoi(df_retarget$vax_moral)
df_retarget$worry_short_term_side_effect[!df_retarget$worry_short_term_side_effect %in% c("1","2","3","4","5")] = NA
df_retarget$worry_short_term_side_effect = strtoi(df_retarget$worry_short_term_side_effect)
df_retarget$worry_long_term_side_effect[!df_retarget$worry_long_term_side_effect %in% c("1","2","3","4","5")] = NA
df_retarget$worry_long_term_side_effect = strtoi(df_retarget$worry_long_term_side_effect)
df_retarget$covid_is_real[!df_retarget$covid_is_real %in% c("1","2","3","4","5")] = NA
df_retarget$covid_is_real = strtoi(df_retarget$covid_is_real)
df_retarget$probably_exposed[!df_retarget$probably_exposed %in% c("1","2","3","4","5")] = NA
df_retarget$probably_exposed = strtoi(df_retarget$probably_exposed)
df_retarget$afraid_needle[!df_retarget$afraid_needle %in% c("1","2","3","4","5")] = NA
df_retarget$afraid_needle = strtoi(df_retarget$afraid_needle)
df_retarget$deeply_religious[!df_retarget$deeply_religious %in% c("1","2","3","4","5")] = NA
df_retarget$deeply_religious = strtoi(df_retarget$deeply_religious)
df_retarget$important_moral[!df_retarget$important_moral %in% c("1","2","3","4","5")] = NA
df_retarget$important_moral = strtoi(df_retarget$important_moral)
df_retarget$fit_in_group_importance[!df_retarget$fit_in_group_importance %in% c("1","2","3","4","5")] = NA
df_retarget$fit_in_group_importance = strtoi(df_retarget$fit_in_group_importance)
df_retarget$responsible_importance[!df_retarget$responsible_importance %in% c("1","2","3","4","5")] = NA
df_retarget$responsible_importance = strtoi(df_retarget$responsible_importance)

Summary Statistics

df_retarget %>%
  #select_if(is.numeric) %>%
  select(covid_is_a_problem, covid_is_problem_my_country,vax_is_safe,vax_prevent_sick_death, need_vax_for_protection,vax_safer_covid,developer_want_to_help,health_worker_want_to_help,gov_want_to_help,important_to_protect_myself,important_to_protect_other,vax_moral,worry_short_term_side_effect,worry_long_term_side_effect,covid_is_real,probably_exposed,afraid_needle,deeply_religious,important_moral,fit_in_group_importance,responsible_importance) %>%
  describe(quant = c(.25,.75) ) %>%
  select(n, mean, sd, se, min, min, first_quartile = Q0.25, median, third_quartile = Q0.75, max) %>%
  clean_names(case = "title") %>%
  rename(SD = Sd, SE = Se) %>%
  kable(caption = "Summary Statistics for 'Sorting Questions'", digits = 3)%>%
  kable_styling(bootstrap_options = c("striped", "hover"))
Summary Statistics for ‘Sorting Questions’
N Mean SD SE Min First Quartile Median Third Quartile Max
covid_is_a_problem 1137 3.170 1.213 0.036 1 2 3.0 4 5
covid_is_problem_my_country 1134 3.061 1.364 0.041 1 2 3.0 4 5
vax_is_safe 1131 3.515 1.218 0.036 1 3 4.0 4 5
vax_prevent_sick_death 1129 3.345 1.227 0.037 1 3 3.0 4 5
need_vax_for_protection 1128 3.922 1.211 0.036 1 4 4.0 5 5
vax_safer_covid 1125 4.054 1.150 0.034 1 4 4.0 5 5
developer_want_to_help 1122 3.860 1.119 0.033 1 3 4.0 5 5
health_worker_want_to_help 1121 4.046 1.012 0.030 1 4 4.0 5 5
gov_want_to_help 1122 3.955 1.052 0.031 1 4 4.0 5 5
important_to_protect_myself 1116 4.404 0.915 0.027 1 4 5.0 5 5
important_to_protect_other 1112 4.374 0.900 0.027 1 4 5.0 5 5
vax_moral 1112 3.410 1.192 0.036 1 3 4.0 4 5
worry_short_term_side_effect 1108 3.540 1.172 0.035 1 3 4.0 4 5
worry_long_term_side_effect 1106 3.788 1.183 0.036 1 3 4.0 5 5
covid_is_real 1104 4.125 1.110 0.033 1 4 4.5 5 5
probably_exposed 1103 2.583 1.241 0.037 1 1 3.0 3 5
afraid_needle 1100 2.783 1.459 0.044 1 1 2.0 4 5
deeply_religious 1097 3.549 1.280 0.039 1 2 4.0 5 5
important_moral 1094 4.102 1.020 0.031 1 4 4.0 5 5
fit_in_group_importance 1094 3.431 1.325 0.040 1 2 4.0 4 5
responsible_importance 1091 4.163 1.021 0.031 1 4 4.0 5 5

Variable Descriptions:

  • covid_is_a_problem: People are still dying from COVID
  • covid_is_problem_my_country: COVID is a problem in [my country]
  • vax_is_safe: I think the COVID vaccines are safe
  • vax_prevent_sick_death: COVID vaccines help prevent serious sickness and death
  • need_vax_for_protection: You need a vaccine for protection from sickness (not because you are sick)
  • vax_safer_covid: Getting the vaccine is much safer than getting COVID
  • developer_want_to_help: I think the people who developed the vaccine wanted to help people
  • health_worker_want_to_help: I think my local healthcare workers want me to be healthy and well
  • gov_want_to_help: I think my government’s department of health workers want me to be healthy and well
  • important_to_protect_myself: It is important to me that I protect myself from the effects of COVID
  • important_to_protect_other: It is important to me that I protect others from the effects of COVID
  • vax_moral: Getting vaccinated is a moral issue
  • worry_short_term_side_effect: I worry about short-term side effects of the COVID vaccine
  • worry_long_term_side_effect: I worry about long-term side effects of the COVID vaccine
  • covid_is_real: COVID has killed millions of people worldwide
  • probably_exposed: I will probably be exposed to someone with COVID over the next year
  • afraid_needle: I am very afraid of needles
  • deeply_religious: I am a deeply religious person
  • important_moral: It is important to me that I be a moral person
  • fit_in_group_importance: It is important to me to feel like I “fit in” in with my group
  • responsible_importance: It is important to me to feel like I am a responsible member of my community

Summary Statistics by Vaccination Status

df_retarget %>%
  select(vax_status_retarget, covid_is_a_problem, covid_is_problem_my_country,vax_is_safe,vax_prevent_sick_death, need_vax_for_protection,vax_safer_covid,developer_want_to_help,health_worker_want_to_help,gov_want_to_help,important_to_protect_myself,important_to_protect_other,vax_moral,worry_short_term_side_effect,worry_long_term_side_effect,covid_is_real,probably_exposed,afraid_needle,deeply_religious,important_moral,fit_in_group_importance,responsible_importance) %>% 
  split(.$vax_status_retarget) %>% 
  map(describe) %>% 
  do.call(rbind, .) %>%
  data.frame() %>%
  select(n, mean , se) %>%
  rownames_to_column() %>%
  separate(rowname, c("vax_status_retarget", "variable"), sep = "\\.") %>%
  filter(variable != "vax_status_retarget*") %>%
  pivot_longer(cols = c("n", "mean", "se")) %>%
  mutate(column = paste(vax_status_retarget, name, sep = "_")) %>%
  select(column, variable, value) %>%
  pivot_wider(names_from = column) %>%
  mutate(difference = `1_mean` - `0_mean`) %>%
  kable(digits = 3,caption = "Summary Statistics for Trust Variables by Vaccination Status", 
        col.names = c("", "N", "Mean", "SE", "N", "Mean", "SE", "Mean Difference")) %>%
  kable_styling(bootstrap_options = c("striped", "hover"))%>%
  add_header_above(c(" " = 1, "Unvaccinated" = 3, "Vaccinated" = 3, "Difference" = 1))
Summary Statistics for Trust Variables by Vaccination Status
Unvaccinated
Vaccinated
Difference
N Mean SE N Mean SE Mean Difference
covid_is_a_problem 292 2.911 0.070 795 3.278 0.043 0.367
covid_is_problem_my_country 292 2.798 0.081 795 3.153 0.048 0.356
vax_is_safe 292 2.853 0.071 794 3.761 0.040 0.908
vax_prevent_sick_death 292 2.863 0.071 794 3.540 0.042 0.677
need_vax_for_protection 292 3.503 0.079 795 4.093 0.039 0.590
vax_safer_covid 292 3.493 0.075 795 4.263 0.036 0.770
developer_want_to_help 292 3.486 0.071 795 3.990 0.038 0.504
health_worker_want_to_help 292 3.712 0.066 794 4.173 0.033 0.460
gov_want_to_help 292 3.562 0.067 795 4.113 0.034 0.552
important_to_protect_myself 292 4.209 0.059 793 4.484 0.030 0.275
important_to_protect_other 292 4.182 0.059 793 4.456 0.030 0.275
vax_moral 292 2.990 0.072 794 3.567 0.041 0.577
worry_short_term_side_effect 292 3.661 0.072 794 3.499 0.041 -0.162
worry_long_term_side_effect 292 3.825 0.074 794 3.775 0.041 -0.051
covid_is_real 292 3.925 0.071 795 4.206 0.038 0.282
probably_exposed 292 2.274 0.071 795 2.694 0.044 0.420
afraid_needle 292 2.842 0.087 794 2.757 0.051 -0.086
deeply_religious 292 3.387 0.075 793 3.609 0.045 0.222
important_moral 292 4.010 0.063 794 4.136 0.035 0.126
fit_in_group_importance 292 3.161 0.080 795 3.526 0.046 0.365
responsible_importance 292 3.942 0.066 795 4.242 0.034 0.300

Variable Descriptions:

  • covid_is_a_problem: People are still dying from COVID
  • covid_is_problem_my_country: COVID is a problem in [my country]
  • vax_is_safe: I think the COVID vaccines are safe
  • vax_prevent_sick_death: COVID vaccines help prevent serious sickness and death
  • need_vax_for_protection: You need a vaccine for protection from sickness (not because you are sick)
  • vax_safer_covid: Getting the vaccine is much safer than getting COVID
  • developer_want_to_help: I think the people who developed the vaccine wanted to help people
  • health_worker_want_to_help: I think my local healthcare workers want me to be healthy and well
  • gov_want_to_help: I think my government’s department of health workers want me to be healthy and well
  • important_to_protect_myself: It is important to me that I protect myself from the effects of COVID
  • important_to_protect_other: It is important to me that I protect others from the effects of COVID
  • vax_moral: Getting vaccinated is a moral issue
  • worry_short_term_side_effect: I worry about short-term side effects of the COVID vaccine
  • worry_long_term_side_effect: I worry about long-term side effects of the COVID vaccine
  • covid_is_real: COVID has killed millions of people worldwide
  • probably_exposed: I will probably be exposed to someone with COVID over the next year
  • afraid_needle: I am very afraid of needles
  • deeply_religious: I am a deeply religious person
  • important_moral: It is important to me that I be a moral person
  • fit_in_group_importance: It is important to me to feel like I “fit in” in with my group
  • responsible_importance: It is important to me to feel like I am a responsible member of my community

Summary Statistics by Vaccination Dose

df_retarget %>%
  select(vax_status_retarget_4,covid_is_a_problem,covid_is_problem_my_country,vax_is_safe,vax_prevent_sick_death, need_vax_for_protection,vax_safer_covid,developer_want_to_help,health_worker_want_to_help,gov_want_to_help,important_to_protect_myself,important_to_protect_other,vax_moral,worry_short_term_side_effect,worry_long_term_side_effect,covid_is_real,probably_exposed,afraid_needle,deeply_religious,important_moral,fit_in_group_importance,responsible_importance) %>% 
  split(.$vax_status_retarget_4) %>% 
  map(describe) %>% 
  do.call(rbind, .) %>%
  data.frame() %>%
  select(n, mean , se) %>%
  rownames_to_column() %>%
  separate(rowname, c("vax_status_retarget_4", "variable"), sep = "\\.") %>%
  filter(variable != "vax_status_retarget_4*") %>%
  pivot_longer(cols = c("n", "mean", "se")) %>%
  mutate(column = paste(vax_status_retarget_4, name, sep = "_")) %>%
  select(column, variable, value) %>%
  pivot_wider(names_from = column) %>%
  kable(digits = 3,caption = "Summary Statistics for Trust Variables by Vaccination Dose", 
        col.names = c("", "N", "Mean", "SE", "N", "Mean", "SE", "N", "Mean", "SE", "N", "Mean", "SE")) %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  add_header_above(c(" " = 1, "Unvaccinated" = 3, "1 dose" = 3, "2 doses" = 3, "3 doses" = 3))
Summary Statistics for Trust Variables by Vaccination Dose
Unvaccinated
1 dose
2 doses
3 doses
N Mean SE N Mean SE N Mean SE N Mean SE
covid_is_a_problem 292 2.911 0.070 231 3.186 0.079 376 3.303 0.060 188 3.340 0.095
covid_is_problem_my_country 292 2.798 0.081 231 3.095 0.092 376 3.144 0.065 188 3.245 0.106
vax_is_safe 292 2.853 0.071 231 3.550 0.079 375 3.877 0.052 188 3.787 0.088
vax_prevent_sick_death 292 2.863 0.071 231 3.385 0.083 375 3.525 0.059 188 3.761 0.081
need_vax_for_protection 292 3.503 0.079 231 3.866 0.081 376 4.178 0.052 188 4.202 0.080
vax_safer_covid 292 3.493 0.075 231 4.065 0.075 376 4.348 0.048 188 4.335 0.075
developer_want_to_help 292 3.486 0.071 231 3.866 0.075 376 4.101 0.048 188 3.920 0.086
health_worker_want_to_help 292 3.712 0.066 231 4.000 0.070 375 4.224 0.045 188 4.282 0.063
gov_want_to_help 292 3.562 0.067 231 3.970 0.072 376 4.162 0.044 188 4.191 0.073
important_to_protect_myself 292 4.209 0.059 230 4.339 0.063 375 4.539 0.040 188 4.553 0.063
important_to_protect_other 292 4.182 0.059 230 4.309 0.064 375 4.515 0.038 188 4.521 0.058
vax_moral 292 2.990 0.072 230 3.465 0.078 376 3.556 0.057 188 3.713 0.086
worry_short_term_side_effect 292 3.661 0.072 230 3.383 0.078 376 3.508 0.057 188 3.622 0.085
worry_long_term_side_effect 292 3.825 0.074 230 3.726 0.079 376 3.798 0.057 188 3.787 0.089
covid_is_real 292 3.925 0.071 231 4.134 0.072 376 4.215 0.053 188 4.277 0.077
probably_exposed 292 2.274 0.071 231 2.602 0.083 376 2.638 0.061 188 2.920 0.094
afraid_needle 292 2.842 0.087 231 2.745 0.097 375 2.675 0.070 188 2.936 0.115
deeply_religious 292 3.387 0.075 230 3.330 0.085 375 3.653 0.064 188 3.862 0.093
important_moral 292 4.010 0.063 230 4.000 0.071 376 4.173 0.048 188 4.229 0.074
fit_in_group_importance 292 3.161 0.080 231 3.312 0.088 376 3.606 0.064 188 3.628 0.098
responsible_importance 292 3.942 0.066 231 4.065 0.070 376 4.306 0.047 188 4.330 0.067

Variable Descriptions:

  • covid_is_a_problem: People are still dying from COVID
  • covid_is_problem_my_country: COVID is a problem in [my country]
  • vax_is_safe: I think the COVID vaccines are safe
  • vax_prevent_sick_death: COVID vaccines help prevent serious sickness and death
  • need_vax_for_protection: You need a vaccine for protection from sickness (not because you are sick)
  • vax_safer_covid: Getting the vaccine is much safer than getting COVID
  • developer_want_to_help: I think the people who developed the vaccine wanted to help people
  • health_worker_want_to_help: I think my local healthcare workers want me to be healthy and well
  • gov_want_to_help: I think my government’s department of health workers want me to be healthy and well
  • important_to_protect_myself: It is important to me that I protect myself from the effects of COVID
  • important_to_protect_other: It is important to me that I protect others from the effects of COVID
  • vax_moral: Getting vaccinated is a moral issue
  • worry_short_term_side_effect: I worry about short-term side effects of the COVID vaccine
  • worry_long_term_side_effect: I worry about long-term side effects of the COVID vaccine
  • covid_is_real: COVID has killed millions of people worldwide
  • probably_exposed: I will probably be exposed to someone with COVID over the next year
  • afraid_needle: I am very afraid of needles
  • deeply_religious: I am a deeply religious person
  • important_moral: It is important to me that I be a moral person
  • fit_in_group_importance: It is important to me to feel like I “fit in” in with my group
  • responsible_importance: It is important to me to feel like I am a responsible member of my community

Summary Statistics by Country

df_retarget %>%
  select(country_answer,covid_is_a_problem,covid_is_problem_my_country,vax_is_safe,vax_prevent_sick_death, need_vax_for_protection,vax_safer_covid,developer_want_to_help,health_worker_want_to_help,gov_want_to_help,important_to_protect_myself,important_to_protect_other,vax_moral,worry_short_term_side_effect,worry_long_term_side_effect,covid_is_real,probably_exposed,afraid_needle,deeply_religious,important_moral,fit_in_group_importance,responsible_importance) %>% 
  split(.$country_answer) %>% 
  map(describe) %>% 
  do.call(rbind, .) %>%
  data.frame() %>%
  select(n, mean , se) %>%
  rownames_to_column() %>%
  separate(rowname, c("country_answer", "variable"), sep = "\\.") %>%
  filter(variable != "country_answer*") %>%
  pivot_longer(cols = c("n", "mean", "se")) %>%
  mutate(column = paste(country_answer, name, sep = "_")) %>%
  select(column, variable, value) %>%
  pivot_wider(names_from = column) %>%
  kable(digits = 3,caption = "Summary Statistics for Trust Variables by Country", 
        col.names = c("", "N", "Mean", "SE", "N", "Mean", "SE", "N", "Mean", "SE", "N", "Mean", "SE")) %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  add_header_above(c(" " = 1, "South Africa" = 3, "Kenya" = 3, "Nigeria" = 3, "Ghana" = 3))
Summary Statistics for Trust Variables by Country
South Africa
Kenya
Nigeria
Ghana
N Mean SE N Mean SE N Mean SE N Mean SE
covid_is_a_problem 280 3.086 0.077 333 3.261 0.066 259 3.266 0.068 265 3.049 0.076
covid_is_problem_my_country 280 3.257 0.088 333 3.207 0.073 259 2.865 0.082 262 2.859 0.080
vax_is_safe 278 3.144 0.082 333 3.670 0.062 258 3.663 0.071 262 3.565 0.071
vax_prevent_sick_death 276 3.163 0.080 333 3.492 0.067 258 3.457 0.071 262 3.240 0.071
need_vax_for_protection 275 3.644 0.082 333 3.991 0.067 258 4.016 0.068 262 4.034 0.068
vax_safer_covid 274 3.715 0.081 332 4.187 0.056 258 4.143 0.065 261 4.153 0.070
developer_want_to_help 273 3.516 0.081 331 3.915 0.057 258 4.186 0.056 260 3.827 0.066
health_worker_want_to_help 272 3.812 0.074 331 4.085 0.053 258 4.140 0.059 260 4.150 0.052
gov_want_to_help 273 3.711 0.075 331 4.066 0.056 258 4.004 0.058 260 4.023 0.059
important_to_protect_myself 269 4.223 0.069 330 4.388 0.052 258 4.469 0.048 259 4.548 0.043
important_to_protect_other 268 4.157 0.068 329 4.426 0.049 258 4.453 0.045 257 4.455 0.050
vax_moral 268 3.340 0.073 329 3.474 0.067 258 3.554 0.069 257 3.257 0.076
worry_short_term_side_effect 265 3.551 0.079 329 3.456 0.061 258 3.609 0.070 256 3.566 0.073
worry_long_term_side_effect 265 3.913 0.074 328 3.796 0.062 257 3.584 0.078 256 3.852 0.072
covid_is_real 264 4.064 0.073 328 4.061 0.059 257 4.132 0.068 255 4.263 0.068
probably_exposed 264 2.883 0.080 328 2.604 0.066 257 2.268 0.075 254 2.563 0.075
afraid_needle 262 2.832 0.097 328 2.713 0.078 257 2.774 0.091 253 2.830 0.089
deeply_religious 261 3.398 0.087 327 3.560 0.071 257 3.619 0.072 252 3.619 0.080
important_moral 261 3.904 0.074 327 4.156 0.056 257 4.233 0.054 249 4.104 0.061
fit_in_group_importance 261 2.981 0.092 327 3.511 0.069 257 3.514 0.082 249 3.711 0.073
responsible_importance 261 3.969 0.070 326 4.181 0.058 257 4.206 0.058 247 4.300 0.058

Variable Descriptions:

  • covid_is_a_problem: People are still dying from COVID
  • covid_is_problem_my_country: COVID is a problem in [my country]
  • vax_is_safe: I think the COVID vaccines are safe
  • vax_prevent_sick_death: COVID vaccines help prevent serious sickness and death
  • need_vax_for_protection: You need a vaccine for protection from sickness (not because you are sick)
  • vax_safer_covid: Getting the vaccine is much safer than getting COVID
  • developer_want_to_help: I think the people who developed the vaccine wanted to help people
  • health_worker_want_to_help: I think my local healthcare workers want me to be healthy and well
  • gov_want_to_help: I think my government’s department of health workers want me to be healthy and well
  • important_to_protect_myself: It is important to me that I protect myself from the effects of COVID
  • important_to_protect_other: It is important to me that I protect others from the effects of COVID
  • vax_moral: Getting vaccinated is a moral issue
  • worry_short_term_side_effect: I worry about short-term side effects of the COVID vaccine
  • worry_long_term_side_effect: I worry about long-term side effects of the COVID vaccine
  • covid_is_real: COVID has killed millions of people worldwide
  • probably_exposed: I will probably be exposed to someone with COVID over the next year
  • afraid_needle: I am very afraid of needles
  • deeply_religious: I am a deeply religious person
  • important_moral: It is important to me that I be a moral person
  • fit_in_group_importance: It is important to me to feel like I “fit in” in with my group
  • responsible_importance: It is important to me to feel like I am a responsible member of my community

Vaccination Status/Attitudes

1. Vaccine doses recieved

df_retarget$num_dose[!df_retarget$num_dose %in% c("0", "1","2","3")] = NA
df_retarget$num_dose = strtoi(df_retarget$num_dose)
df_retarget$num_dose = as.factor(df_retarget$num_dose)
dose = df_retarget %>% filter(!is.na(num_dose))
dose_plot <- dose %>% count(num_dose) %>% mutate(percentage = n / nrow(dose))
ggplot(dose_plot, aes(x = fct_inorder(num_dose), y = n, fill = num_dose)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
  ggtitle(paste0("Vaccine doses recieved (n = ", sum(dose_plot$n), ")"),
          subtitle = "How many COVID vaccine doses have you recieved?") +
  theme_bw() +
  theme(plot.title = element_text(face = "bold"), legend.position = "none") +
  labs(x = "Vaccine doses recieved", y = "count")

df_retarget %>%
  drop_na(country_answer, num_dose) %>%
  count(country_answer, num_dose) %>%
  mutate(
    num_dose = case_when(
      num_dose == 0 ~ "unvaccinated",
      num_dose == 1 ~ "1 dose",
      num_dose == 2 ~ "2 doses",
      num_dose == 3 ~ "3 doses",
    ),
    #`Analysis 3 - impediment theme` = `Analysis 3 - impediment theme` %>% str_to_sentence()
  ) %>%
  drop_na(country_answer, num_dose) %>%
  arrange(country_answer) %>%
  mutate(num_dose = fct_inorder(num_dose)) %>%
  ggplot(aes(country_answer, n, fill = num_dose)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "country",
    y = "Count",
    fill = "",
    title = "Distribution of vaccine doses recieved by country"
  )

2. Get a COVID vaccine/booster next year

df_retarget$vax_next_year[!df_retarget$vax_next_year %in% c("1","2","3","4","5")] = NA
df_retarget$vax_next_year = strtoi(df_retarget$vax_next_year)
df_retarget$vax_next_year = as.factor(df_retarget$vax_next_year)
vax_future = df_retarget %>% filter(!is.na(vax_next_year))
vax_future_plot <- vax_future %>% count(vax_next_year) %>% mutate(percentage = n / nrow(vax_future))
ggplot(vax_future_plot, aes(x = fct_inorder(vax_next_year), y = n, fill = vax_next_year)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
  ggtitle(paste0("How likely to get a COVID vaccine/booster next year (n = ", sum(dose_plot$n), ")"),
          subtitle = "How likely are you to get a COVID vaccine/booster next year?") +
  theme_bw() +
  theme(plot.title = element_text(face = "bold"), legend.position = "none") +
  labs(x = "how likely to get a vaccine/booster", y = "count")

df_retarget %>%
  mutate(
    vax_status_retarget = case_when(
      vax_status_retarget == 0 ~ "unvaccinated",
      vax_status_retarget == 1 ~ "vaccinated"
    )
  ) %>%
  drop_na(vax_status_retarget, vax_next_year) %>%
  count(vax_status_retarget, vax_next_year) %>%
  mutate(
    vax_next_year = case_when(
      vax_next_year == 1 ~ "1 = very unlikely",
      vax_next_year == 2 ~ "2 = somewhat unlikely",
      vax_next_year == 3 ~ "3 = unsure",
      vax_next_year == 4 ~ "4 = probably will",
      vax_next_year == 5 ~ "5 = definitely will",
    ),
    #`Analysis 3 - impediment theme` = `Analysis 3 - impediment theme` %>% str_to_sentence()
  ) %>%
  arrange(vax_status_retarget) %>%
  mutate(vax_next_year = fct_inorder(vax_next_year)) %>%
  ggplot(aes(vax_status_retarget, n, fill = vax_next_year)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "vaccination status",
    y = "Count",
    fill = "",
    title = "Distribution of likelihood by vaccination status"
  )

df_retarget %>%
  drop_na(country_answer, vax_next_year) %>%
  count(country_answer, vax_next_year) %>%
  mutate(
    vax_next_year = case_when(
      vax_next_year == 1 ~ "1 = very unlikely",
      vax_next_year == 2 ~ "2 = somewhat unlikely",
      vax_next_year == 3 ~ "3 = unsure",
      vax_next_year == 4 ~ "4 = probably will",
      vax_next_year == 5 ~ "5 = definitely will",
    ),
    #`Analysis 3 - impediment theme` = `Analysis 3 - impediment theme` %>% str_to_sentence()
  ) %>%
  arrange(country_answer) %>%
  mutate(vax_next_year = fct_inorder(vax_next_year)) %>%
  drop_na(country_answer, vax_next_year) %>%
  ggplot(aes(country_answer, n, fill = vax_next_year)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "country",
    y = "Count",
    fill = "",
    title = "Distribution of likelihood by country"
  )

3. Recieved any other vaccines

df_retarget$receive_other_vax[!df_retarget$receive_other_vax %in% c("yes","no")] = NA
df_retarget$receive_other_vax = as.factor(df_retarget$receive_other_vax)
other_vax = df_retarget %>% filter(!is.na(receive_other_vax))
other_vax_plot <- other_vax %>% count(receive_other_vax) %>% mutate(percentage = n / nrow(other_vax))
ggplot(other_vax_plot, aes(x = fct_inorder(receive_other_vax), y = n, fill = receive_other_vax)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
  ggtitle(paste0("Recieved any other vaccines (n = ", sum(dose_plot$n), ")"),
          subtitle = "Have you ever recieved any other vaccines?") +
  theme_bw() +
  theme(plot.title = element_text(face = "bold"), legend.position = "none") +
  labs(x = "recieved other vaccines", y = "count")

df_retarget %>%
  mutate(
    vax_status_retarget = case_when(
      vax_status_retarget == 0 ~ "unvaccinated",
      vax_status_retarget == 1 ~ "vaccinated"
    )
  ) %>%
  drop_na(vax_status_retarget, receive_other_vax) %>%
  count(vax_status_retarget, receive_other_vax) %>%
  # mutate(
  #   receive_other_vax = case_when(
  #     vax_next_year == 1 ~ "1 = very unlikely",
  #     vax_next_year == 2 ~ "2 = somewhat unlikely",
  #     vax_next_year == 3 ~ "3 = unsure",
  #     vax_next_year == 4 ~ "4 = probably will",
  #     vax_next_year == 5 ~ "5 = definitely will",
  #   ),
  #   #`Analysis 3 - impediment theme` = `Analysis 3 - impediment theme` %>% str_to_sentence()
  # ) %>%
  arrange(vax_status_retarget) %>%
  mutate(receive_other_vax = fct_inorder(receive_other_vax)) %>%
  ggplot(aes(vax_status_retarget, n, fill = receive_other_vax)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "vaccination status",
    y = "Count",
    fill = "Recieved any other vaccines?",
    title = "Distribution of have or have not recieved any other vaccines by vaccination status"
  )

df_retarget %>%
  drop_na(country_answer, receive_other_vax) %>%
  count(country_answer, receive_other_vax) %>%
  arrange(country_answer) %>%
  #mutate(receive_other_vax = fct_inorder(receive_other_vax)) %>%
  ggplot(aes(country_answer, n, fill = receive_other_vax)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "country",
    y = "Count",
    fill = "Recieved any other vaccines?",
    title = "Distribution of have or have not recieved any other vaccines by country"
  )

Access Questions

1. Time to travel to the closest vaccination site

df_retarget$time_to_get_vax[!df_retarget$time_to_get_vax %in% c("Less than 20 min","20-60 min", "1-2 hrs", "2+ hrs")] = NA
df_retarget$time_to_get_vax = factor(df_retarget$time_to_get_vax, levels=c("Less than 20 min","20-60 min", "1-2 hrs", "2+ hrs"))
time_get_vax = df_retarget %>% filter(!is.na(time_to_get_vax))
time_get_vax_plot <- time_get_vax %>% count(time_to_get_vax) %>% mutate(percentage = n / nrow(time_get_vax))
ggplot(time_get_vax_plot, aes(x = (time_to_get_vax), y = n, fill = time_to_get_vax)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
  ggtitle(paste0("Time to travel to the closest vaccination site (n = ", sum(dose_plot$n), ")"),
          subtitle = "How long do you think it would take you to travel to the closest vaccination site?\nHow long did it take you to travel to the place where you recieved the vaccine?") +
  theme_bw() +
  theme(plot.title = element_text(face = "bold"), legend.position = "none") +
  labs(x = "Time needed", y = "count")

df_retarget %>%
  mutate(
    vax_status_retarget = case_when(
      vax_status_retarget == 0 ~ "unvaccinated",
      vax_status_retarget == 1 ~ "vaccinated"
    )
  ) %>%
  drop_na(vax_status_retarget, time_to_get_vax) %>%
  count(vax_status_retarget, time_to_get_vax) %>%
  # mutate(
  #   receive_other_vax = case_when(
  #     vax_next_year == 1 ~ "1 = very unlikely",
  #     vax_next_year == 2 ~ "2 = somewhat unlikely",
  #     vax_next_year == 3 ~ "3 = unsure",
  #     vax_next_year == 4 ~ "4 = probably will",
  #     vax_next_year == 5 ~ "5 = definitely will",
  #   ),
  #   #`Analysis 3 - impediment theme` = `Analysis 3 - impediment theme` %>% str_to_sentence()
  # ) %>%
  arrange(vax_status_retarget) %>%
  #mutate(time_to_get_vax = fct_inorder(time_to_get_vax)) %>%
  ggplot(aes(vax_status_retarget, n, fill = time_to_get_vax)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "vaccination status",
    y = "Count",
    fill = "Time needed",
    title = "Distribution of Time to travel to the closest vaccination site by vaccination status"
  )

df_retarget %>%
  drop_na(country_answer, time_to_get_vax) %>%
  count(country_answer, time_to_get_vax) %>%
  arrange(country_answer) %>%
  #mutate(time_to_get_vax = fct_inorder(time_to_get_vax)) %>%
  ggplot(aes(country_answer, n, fill = time_to_get_vax)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "country",
    y = "Count",
    fill = "Time needed",
    title = "Distribution of Time to travel to the closest vaccination site by country"
  )

df_retarget %>%
  mutate(
    vax_status_retarget = case_when(
      vax_status_retarget == 0 ~ "unvaccinated",
      vax_status_retarget == 1 ~ "vaccinated"
    )
  ) %>%
  filter(vax_status_retarget == "unvaccinated") %>%
  drop_na(country_answer, time_to_get_vax) %>%
  count(country_answer, time_to_get_vax) %>%
  arrange(country_answer) %>%
  #mutate(time_to_get_vax = fct_inorder(time_to_get_vax)) %>%
  ggplot(aes(country_answer, n, fill = time_to_get_vax)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "country",
    y = "Count",
    fill = "Time needed",
    title = "Distribution of Time to travel to the closest vaccination site by country (Unvaccinated)"
  )

2. Waiting time on vaccination site

df_retarget$wait_time[!df_retarget$wait_time %in% c("Less than 20 min","20-60 min", "1-2 hrs", "2+ hrs")] = NA
df_retarget$wait_time = factor(df_retarget$wait_time, levels=c("Less than 20 min","20-60 min", "1-2 hrs", "2+ hrs"))
time_get_vax = df_retarget %>% filter(!is.na(wait_time))
time_get_vax_plot <- time_get_vax %>% count(wait_time) %>% mutate(percentage = n / nrow(time_get_vax))
ggplot(time_get_vax_plot, aes(x = (wait_time), y = n, fill = wait_time)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
  ggtitle(paste0("Waiting time on vaccination site (n = ", sum(dose_plot$n), ")"),
          subtitle = "How long do you think you would wait to get the vaccine once you reach the vaccination site?\nHow long did you wait once you arrived at the vaccination site?") +
  theme_bw() +
  theme(plot.title = element_text(face = "bold"), legend.position = "none") +
  labs(x = "Time needed", y = "count")

df_retarget %>%
  mutate(
    vax_status_retarget = case_when(
      vax_status_retarget == 0 ~ "unvaccinated",
      vax_status_retarget == 1 ~ "vaccinated"
    )
  ) %>%
  drop_na(vax_status_retarget, wait_time) %>%
  count(vax_status_retarget, wait_time) %>%
  arrange(vax_status_retarget) %>%
  ggplot(aes(vax_status_retarget, n, fill = wait_time)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "vaccination status",
    y = "Count",
    fill = "Time needed",
    title = "Distribution of Waiting time on vaccination site by vaccination status"
  )

df_retarget %>%
  drop_na(country_answer, wait_time) %>%
  count(country_answer, wait_time) %>%
  arrange(country_answer) %>%
  ggplot(aes(country_answer, n, fill = wait_time)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "country",
    y = "Count",
    fill = "Time needed",
    title = "Distribution of Waiting time on vaccination site by country"
  )

3. How to get to the closest vaccination site?

df_retarget$transportation_vax[!df_retarget$transportation_vax %in% c("walking","bicyle", "bus", "car", "train", "other", "Don't know")] = NA
df_retarget$transportation_vax = factor(df_retarget$transportation_vax, levels=c("walking","bicyle", "bus", "car", "train", "other", "Don't know"))
transportation_get_vax = df_retarget %>% filter(!is.na(transportation_vax))
transportation_get_vax_plot <- transportation_get_vax %>% count(transportation_vax) %>% mutate(percentage = n / nrow(transportation_get_vax))
ggplot(transportation_get_vax_plot, aes(x = (transportation_vax), y = n, fill = transportation_vax)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
  ggtitle(paste0("Transportation to vaccination site (n = ", sum(dose_plot$n), ")"),
          subtitle = "How do you think you would you get to your closest vaccination site?\nHow did you get there?") +
  theme_bw() +
  theme(plot.title = element_text(face = "bold"), legend.position = "none") +
  labs(x = "transportation", y = "count")

df_retarget %>%
  mutate(
    vax_status_retarget = case_when(
      vax_status_retarget == 0 ~ "unvaccinated",
      vax_status_retarget == 1 ~ "vaccinated"
    )
  ) %>%
  drop_na(vax_status_retarget, transportation_vax) %>%
  count(vax_status_retarget, transportation_vax) %>%
  arrange(vax_status_retarget) %>%
  ggplot(aes(vax_status_retarget, n, fill = transportation_vax)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "vaccination status",
    y = "Count",
    fill = "",
    title = "Distribution of Transportation to vaccination site by vaccination status"
  )

df_retarget %>%
  drop_na(country_answer, transportation_vax) %>%
  count(country_answer, transportation_vax) %>%
  arrange(country_answer) %>%
  ggplot(aes(country_answer, n, fill = transportation_vax)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "country",
    y = "Count",
    fill = "",
    title = "Distribution of Transportation to vaccination site by country"
  )

4. Need an appointment or Not

df_retarget$need_appointment[!df_retarget$need_appointment %in% c("yes","no")] = NA
df_retarget$need_appointment = factor(df_retarget$need_appointment, levels=c("yes","no"))
appointment = df_retarget %>% filter(!is.na(need_appointment))
appointment_plot <- appointment %>% count(need_appointment) %>% mutate(percentage = n / nrow(appointment))
ggplot(appointment_plot, aes(x = (need_appointment), y = n, fill = need_appointment)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
  ggtitle(paste0("Need an appointment or Not (n = ", sum(dose_plot$n), ")"),
          subtitle = "Do you think you would need an appointment?\nDid you need an appointment?") +
  theme_bw() +
  theme(plot.title = element_text(face = "bold"), legend.position = "none") +
  labs(x = "appointment needed", y = "count")

df_retarget %>%
  mutate(
    vax_status_retarget = case_when(
      vax_status_retarget == 0 ~ "unvaccinated",
      vax_status_retarget == 1 ~ "vaccinated"
    )
  ) %>%
  drop_na(vax_status_retarget, need_appointment) %>%
  count(vax_status_retarget, need_appointment) %>%
  arrange(vax_status_retarget) %>%
  ggplot(aes(vax_status_retarget, n, fill = need_appointment)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "vaccination status",
    y = "Count",
    fill = "appointment needed",
    title = "Distribution of appointment needed by vaccination status"
  )

df_retarget %>%
  drop_na(country_answer, need_appointment) %>%
  count(country_answer, need_appointment) %>%
  arrange(country_answer) %>%
  ggplot(aes(country_answer, n, fill = need_appointment)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "country",
    y = "Count",
    fill = "appointment needed",
    title = "Distribution of appointment needed to vaccination site by country"
  )

5. Need to pay or Not (excluding travel cost)

Note: only vaccinated people been asked for multiple choice question

df_retarget$vax_cost[!df_retarget$vax_cost %in% c("yes","no")] = NA
df_retarget$vax_cost = factor(df_retarget$vax_cost, levels=c("yes","no"))
cost = df_retarget %>% filter(!is.na(vax_cost))
cost_plot <- cost %>% count(vax_cost) %>% mutate(percentage = n / nrow(cost))
ggplot(cost_plot, aes(x = (vax_cost), y = n, fill = vax_cost)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
  ggtitle(paste0("Have to pay to get the vaccine (n = ", sum(dose_plot$n), ")"),
          subtitle = "Did you have to pay anything to get the vaccine (excluding travel cost)?") +
  theme_bw() +
  theme(plot.title = element_text(face = "bold"), legend.position = "none") +
  labs(x = "payment needed", y = "count")

df_retarget %>%
  drop_na(country_answer, vax_cost) %>%
  count(country_answer, vax_cost) %>%
  arrange(country_answer) %>%
  ggplot(aes(country_answer, n, fill = vax_cost)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "country",
    y = "Count",
    fill = "payment needed",
    title = "Distribution of payment needed by country"
  )

6. Would like to back to the same place for another dose

Note: only vaccinated people been asked

df_retarget$go_back_another_dose[!df_retarget$go_back_another_dose %in% c("yes","no")] = NA
df_retarget$go_back_another_dose = factor(df_retarget$go_back_another_dose, levels=c("yes","no"))
go_back = df_retarget %>% filter(!is.na(go_back_another_dose))
go_back_plot <- go_back %>% count(go_back_another_dose) %>% mutate(percentage = n / nrow(go_back))
ggplot(go_back_plot, aes(x = (go_back_another_dose), y = n, fill = go_back_another_dose)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
  ggtitle(paste0("Would like to go back for another dose (n = ", sum(dose_plot$n), ")"),
          subtitle = "Would you go back to the same place if you wanted another dose?") +
  theme_bw() +
  theme(plot.title = element_text(face = "bold"), legend.position = "none") +
  labs(x = "would like to go back", y = "count")

df_retarget %>%
  drop_na(country_answer, go_back_another_dose) %>%
  count(country_answer, go_back_another_dose) %>%
  arrange(country_answer) %>%
  ggplot(aes(country_answer, n, fill = go_back_another_dose)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "country",
    y = "Count",
    fill = "likelihood",
    title = "Distribution of likelihood to go back for another dose by country"
  )

7. Day of the week preferred to get vaccine

df_retarget$prefer_day[!df_retarget$prefer_day %in% c("Su","M", "Tu", "W", "Th", "F", "S")] = NA
df_retarget$prefer_day = factor(df_retarget$prefer_day, levels=c("Su","M", "Tu", "W", "Th", "F", "S"))
prefer_day_vax = df_retarget %>% filter(!is.na(prefer_day))
prefer_day_vax_plot <- prefer_day_vax %>% count(prefer_day) %>% mutate(percentage = n / nrow(prefer_day_vax))
ggplot(prefer_day_vax_plot, aes(x = (prefer_day), y = n, fill = prefer_day)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
  ggtitle(paste0("Preferred day of week to get vaccine (n = ", sum(dose_plot$n), ")"),
          subtitle = "If you wanted to get vaccinated, what day of the week would be ideal for you?") +
  theme_bw() +
  theme(plot.title = element_text(face = "bold"), legend.position = "none") +
  labs(x = "Day", y = "count")

df_retarget %>%
  mutate(
    vax_status_retarget = case_when(
      vax_status_retarget == 0 ~ "unvaccinated",
      vax_status_retarget == 1 ~ "vaccinated"
    )
  ) %>%
  drop_na(vax_status_retarget, prefer_day) %>%
  count(vax_status_retarget, prefer_day) %>%
  arrange(vax_status_retarget) %>%
  ggplot(aes(vax_status_retarget, n, fill = prefer_day)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "vaccination status",
    y = "Count",
    fill = "Time needed",
    title = "Distribution of Preferred day of week to get vaccine by vaccination status"
  )

df_retarget %>%
  drop_na(country_answer, prefer_day) %>%
  count(country_answer, prefer_day) %>%
  arrange(country_answer) %>%
  ggplot(aes(country_answer, n, fill = prefer_day)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "country",
    y = "Count",
    fill = "Preferred day of week",
    title = "Distribution of Preferred day of week to get vaccine by country"
  )

Demographics

Continuous Demographic Variables

Starred variables have a corresponding variable, with the suffix _num (ie education_num) that provides a numeric ordering of the variables. This order is listed in parenthesis.

Variable Description
gender* male (0) or female (1)
age integer 18 to 99
education* < high school (1), high school (2), some college (3), 2-year degree (4), 4-year degree (5), graduate degree (6), other, prefer not to say
location* rural(1), suburban (2), urban(3), other, prefer not to say
religiosity* not very religious (1), somewhat religious (2), very religious (3), other, prefer not to say
white 1 if the participant is a white or caucasian, 0 if not
ethnicity asian or indian, black or african, coloured, white or caucasian, other, prefer not to say
## clean demographic data
numeric_cols <- function(df){
  out <- df %>%
    mutate(
      age = as.numeric(ifelse(demog_age %in% paste(18:99), demog_age, "")),
      gender_num = case_when(
        gender == "female" ~ 1,
        gender == "male" ~ 0
        ),
      education_num = case_when(
        demog_education == "< High school" ~ 1,
        demog_education == "High school" ~ 2,
        demog_education == "Some college" ~ 3,
        demog_education == "2-year degree" ~ 4,
        demog_education == "4-year degree" ~ 5,
        demog_education == "Graduate degree" ~ 6,
      ),
      religiosity_num = case_when(
        religiosity == "Not very religious" ~ 1,
        religiosity == "Somewhat religious" ~ 2,
        religiosity == "Very religious" ~ 3,
      ),
      location_num = case_when(
        location == "Rural" ~ 1,
        location == "Suburban" ~ 2,
        location == "Urban" ~ 3,
      ),
      location =factor(location, levels = c("Urban", "Suburban", "Rural", "Prefer not to say")),
      white = ifelse(ethnicity == "White or Caucasian", 1, 0),
      ethnicity = factor(ethnicity, levels=c("Asian or Indian", 
                                                "Black or African", 
                                                "coloured", 
                                                "White or Caucasian", 
                                                "Other",
                                                "Prefer not to say")
    ))
    return(out)
}
df_retarget_num = numeric_cols(df_retarget)
df_retarget_num %>%
  select_if(is.numeric) %>%
  select(age, education = education_num, location=location_num, religiosity = religiosity_num, gender = gender_num, white) %>%
  describe(quant = c(.25,.75) ) %>%
  select(n, mean, sd, se, min, min, first_quartile = Q0.25, median, third_quartile = Q0.75, max) %>%
  clean_names(case = "title") %>%
  rename(SD = Sd, SE = Se) %>%
  kable(caption = "Summary Statistics for Continuous Demographic Variables", digits = 3)%>%
  kable_styling(bootstrap_options = c("striped", "hover"))
Summary Statistics for Continuous Demographic Variables
N Mean SD SE Min First Quartile Median Third Quartile Max
age 1036 27.488 8.065 0.251 18 22 25 31.00 64
education 1006 3.112 1.582 0.050 1 2 3 4.75 6
location 1008 2.179 0.829 0.026 1 1 2 3.00 3
religiosity 958 2.374 0.724 0.023 1 2 3 3.00 3
gender 1747 0.386 0.487 0.012 0 0 0 1.00 1
white 1753 0.011 0.106 0.003 0 0 0 0.00 1
df_retarget_num$vax_status_retarget = as.numeric(df_retarget_num$vax_status_retarget)
df_retarget_num %>%
  select_if(is.numeric) %>%
  select(vax_status_retarget, age, education = education_num, location=location_num, religiosity = religiosity_num, gender = gender_num, white) %>%
  split(.$vax_status_retarget) %>% 
  map(describe) %>% 
  do.call(rbind, .) %>%
  data.frame() %>%
  select(n, mean , se) %>%
  rownames_to_column() %>%
  separate(rowname, c("vax_status_retarget", "variable"), sep = "\\.") %>%
  filter(variable != "vax_status_retarget") %>%
  pivot_longer(cols = c("n", "mean", "se")) %>%
  mutate(column = paste(vax_status_retarget, name, sep = "_")) %>%
  select(column, variable, value) %>%
  pivot_wider(names_from = column) %>%
  kable(digits = 3,caption = "Summary Statistics for Continuous Demographic Variables by Vaccination Status", 
        col.names = c("", "N", "Mean", "SE", "N", "Mean", "SE")) %>%
  kable_styling(bootstrap_options = c("striped", "hover"))%>%
  add_header_above(c(" " = 1, "Unvaccinated" = 3, "Vaccinated" = 3))
Summary Statistics for Continuous Demographic Variables by Vaccination Status
Unvaccinated
Vaccinated
N Mean SE N Mean SE
age 283 25.947 0.486 753 28.068 0.290
education 277 3.047 0.096 729 3.137 0.058
location 265 2.208 0.049 722 2.166 0.031
religiosity 252 2.290 0.047 685 2.403 0.027
gender 291 0.323 0.027 793 0.372 0.017
white 292 0.021 0.008 795 0.018 0.005
df_retarget_num$vax_status_retarget_4 = as.numeric(df_retarget_num$vax_status_retarget_4)
df_retarget_num %>%
  select_if(is.numeric) %>%
  select(vax_status_retarget_4, age, education = education_num, location=location_num, religiosity = religiosity_num, gender = gender_num, white) %>%
  split(.$vax_status_retarget_4) %>% 
  map(describe) %>% 
  do.call(rbind, .) %>%
  data.frame() %>%
  select(n, mean , se) %>%
  rownames_to_column() %>%
  separate(rowname, c("vax_status_retarget_4", "variable"), sep = "\\.") %>%
  filter(variable != "vax_status_retarget_4") %>%
  pivot_longer(cols = c("n", "mean", "se")) %>%
  mutate(column = paste(vax_status_retarget_4, name, sep = "_")) %>%
  select(column, variable, value) %>%
  pivot_wider(names_from = column) %>%
  kable(digits = 3,caption = "Summary Statistics for Continuous Demographic Variables by Vaccination dose received", 
        col.names = c("", "N", "Mean", "SE", "N", "Mean", "SE", "N", "Mean", "SE", "N", "Mean", "SE")) %>%
  kable_styling(bootstrap_options = c("striped", "hover"))%>%
  add_header_above(c(" " = 1, "Unvaccinated" = 3, "1 dose" = 3, "2 doses" = 3, "3 doses" = 3))
Summary Statistics for Continuous Demographic Variables by Vaccination dose received
Unvaccinated
1 dose
2 doses
3 doses
N Mean SE N Mean SE N Mean SE N Mean SE
age 283 25.947 0.486 220 26.686 0.463 356 28.225 0.420 177 29.469 0.674
education 277 3.047 0.096 216 3.032 0.108 342 3.173 0.083 171 3.199 0.125
location 265 2.208 0.049 210 2.167 0.058 345 2.139 0.045 167 2.222 0.066
religiosity 252 2.290 0.047 198 2.298 0.052 322 2.416 0.040 165 2.503 0.053
gender 291 0.323 0.027 230 0.348 0.031 375 0.395 0.025 188 0.356 0.035
white 292 0.021 0.008 231 0.035 0.012 376 0.008 0.005 188 0.016 0.009
df_retarget_num %>%
  select(country_answer, age, education = education_num, location=location_num, religiosity = religiosity_num, gender = gender_num, white) %>%
  split(.$country_answer) %>% 
  map(describe) %>% 
  do.call(rbind, .) %>%
  data.frame() %>%
  select(n, mean , se) %>%
  rownames_to_column() %>%
  separate(rowname, c("country_answer", "variable"), sep = "\\.") %>%
  filter(variable != "country_answer*") %>%
  pivot_longer(cols = c("n", "mean", "se")) %>%
  mutate(column = paste(country_answer, name, sep = "_")) %>%
  select(column, variable, value) %>%
  pivot_wider(names_from = column) %>%
  kable(digits = 3,caption = "Summary Statistics for Continuous Demographic Variables by country", 
        col.names = c("", "N", "Mean", "SE", "N", "Mean", "SE", "N", "Mean", "SE", "N", "Mean", "SE")) %>%
  kable_styling(bootstrap_options = c("striped", "hover"))%>%
  add_header_above(c(" " = 1, "South Africa" = 3, "Kenya" = 3, "Nigeria" = 3, "Ghana" = 3))
Summary Statistics for Continuous Demographic Variables by country
South Africa
Kenya
Nigeria
Ghana
N Mean SE N Mean SE N Mean SE N Mean SE
age 244 31.344 0.628 313 26.856 0.377 249 24.896 0.427 230 27.065 0.503
education 232 2.328 0.080 312 3.462 0.086 241 3.523 0.110 221 2.995 0.104
location 237 2.169 0.055 320 2.075 0.045 243 2.366 0.049 208 2.130 0.061
religiosity 219 2.269 0.052 304 2.336 0.041 231 2.424 0.044 204 2.485 0.051
gender 503 0.571 0.022 427 0.326 0.023 347 0.343 0.026 470 0.277 0.021
white 507 0.026 0.007 428 0.002 0.002 347 0.012 0.006 471 0.004 0.003

Other Demographic Variables

1. Ethnicity

df_retarget$ethnicity[!df_retarget$ethnicity %in% c("Black or African","White or Caucasian", "Asian or Indian", "Other", "Prefer not to say")] = NA
df_retarget$ethnicity = factor(df_retarget$ethnicity, levels=c("Black or African","White or Caucasian", "Asian or Indian", "Other", "Prefer not to say"))
ethnicity_df = df_retarget %>% filter(!is.na(ethnicity))
ethnicity_df_plot <- ethnicity_df %>% count(ethnicity) %>% mutate(percentage = n / nrow(ethnicity_df))
ggplot(ethnicity_df_plot, aes(x = (ethnicity), y = n, fill = ethnicity)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
  ggtitle(paste0("Ethnicity (n = ", sum(dose_plot$n), ")"),
          subtitle = "Which best describes you?") +
  theme_bw() +
  theme(plot.title = element_text(face = "bold"), legend.position = "none") +
  labs(x = "Religion", y = "count")

df_retarget %>%
  mutate(
    vax_status_retarget = case_when(
      vax_status_retarget == 0 ~ "unvaccinated",
      vax_status_retarget == 1 ~ "vaccinated"
    )
  ) %>%
  drop_na(vax_status_retarget, ethnicity) %>%
  count(vax_status_retarget, ethnicity) %>%
  arrange(vax_status_retarget) %>%
  ggplot(aes(vax_status_retarget, n, fill = ethnicity)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "ethnicity",
    y = "Count",
    fill = "ethnicity",
    title = "Distribution of ethnicity by vaccination status"
  )

df_retarget %>%
  drop_na(country_answer, ethnicity) %>%
  count(country_answer, ethnicity) %>%
  arrange(country_answer) %>%
  ggplot(aes(country_answer, n, fill = ethnicity)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "ethnicity",
    y = "Count",
    fill = "ethnicity",
    title = "Distribution of ethnicity by country"
  )

2. Religion

df_retarget$demog_religion[!df_retarget$demog_religion %in% c("Christianity","Islam", "African traditional", "Hinduism", "Judaism", "No religion", "Other", "Prefer not to say")] = NA
df_retarget$demog_religion = factor(df_retarget$demog_religion, levels=c("Christianity","Islam", "African traditional", "Hinduism", "Judaism", "No religion", "Other", "Prefer not to say"))
religion_df = df_retarget %>% filter(!is.na(demog_religion))
religion_df_plot <- religion_df %>% count(demog_religion) %>% mutate(percentage = n / nrow(religion_df))
ggplot(religion_df_plot, aes(x = (demog_religion), y = n, fill = demog_religion)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
  ggtitle(paste0("Religion (n = ", sum(dose_plot$n), ")"),
          subtitle = "What's your religion, if any?") +
  theme_bw() +
  theme(plot.title = element_text(face = "bold"), legend.position = "none") +
  labs(x = "Religion", y = "count")

df_retarget %>%
  mutate(
    vax_status_retarget = case_when(
      vax_status_retarget == 0 ~ "unvaccinated",
      vax_status_retarget == 1 ~ "vaccinated"
    )
  ) %>%
  drop_na(vax_status_retarget, demog_religion) %>%
  count(vax_status_retarget, demog_religion) %>%
  arrange(vax_status_retarget) %>%
  ggplot(aes(vax_status_retarget, n, fill = demog_religion)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "Religion",
    y = "Count",
    fill = "Religion",
    title = "Distribution of Religion by vaccination status"
  )

df_retarget %>%
  drop_na(country_answer, demog_religion) %>%
  count(country_answer, demog_religion) %>%
  arrange(country_answer) %>%
  ggplot(aes(country_answer, n, fill = demog_religion)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "Religion",
    y = "Count",
    fill = "Religion",
    title = "Distribution of Religion by country"
  )

3. Income

South Africa
df_SA = df_retarget %>% filter(country_answer == "South Africa")
df_SA$demog_income[!df_SA$demog_income %in% c("< R5,000","R5,000 - R9,999", "R10,000 - R29,999", "R30,000 - R49,999", "R50,000 - R99,999", "> R100,000")] = NA
df_SA$demog_income = factor(df_SA$demog_income, levels=c("< R5,000","R5,000 - R9,999", "R10,000 - R29,999", "R30,000 - R49,999", "R50,000 - R99,999", "> R100,000"))
SA = df_SA %>% filter(!is.na(demog_income))
SA_plot <- SA %>% count(demog_income) %>% mutate(percentage = n / nrow(SA))
ggplot(SA_plot, aes(x = (demog_income), y = n, fill = demog_income)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
  ggtitle(paste0("Income - South Africa (n = ", sum(dose_plot$n), ")"),
          subtitle = "How much do you earn in a year?") +
  theme_bw() +
  theme(plot.title = element_text(face = "bold"), legend.position = "none") +
  labs(x = "Income", y = "count")

Kenya
df_Kenya = df_retarget %>% filter(country_answer == "Kenya")
df_Kenya$demog_income[!df_Kenya$demog_income %in% c("< 50k KSh","50k KSh - 100k KSh", "100k KSh - 300k KSh", "300k KSh - 500k Ksh", "500k Ksh-1,000k KSh", "> 1,000k KSh")] = NA
df_Kenya$demog_income = factor(df_Kenya$demog_income, levels=c("< 50k KSh","50k KSh - 100k KSh", "100k KSh - 300k KSh", "300k KSh - 500k Ksh", "500k Ksh-1,000k KSh", "> 1,000k KSh"))
Kenya = df_Kenya %>% filter(!is.na(demog_income))
Kenya_plot <- Kenya %>% count(demog_income) %>% mutate(percentage = n / nrow(Kenya))
ggplot(Kenya_plot, aes(x = (demog_income), y = n, fill = demog_income)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
  ggtitle(paste0("Income - Kenya (n = ", sum(dose_plot$n), ")"),
          subtitle = "How much do you earn in a year?") +
  theme_bw() +
  theme(plot.title = element_text(face = "bold"), legend.position = "none") +
  labs(x = "Income", y = "count")

Nigeria
df_Nigeria = df_retarget %>% filter(country_answer == "Nigeria")
df_Nigeria$demog_income[!df_Nigeria$demog_income %in% c("< 50,000₦","50,000 - 99,999₦", "100,000₦  - 299,999₦", "300,000₦  - 499,999₦", "500,000₦  - 999,999₦", "> 1,000,000₦")] = NA
df_Nigeria$demog_income = factor(df_Nigeria$demog_income, levels=c("< 50,000₦","50,000 - 99,999₦", "100,000₦  - 299,999₦", "300,000₦  - 499,999₦", "500,000₦  - 999,999₦", "> 1,000,000₦"))
Nigeria = df_Nigeria %>% filter(!is.na(demog_income))
Nigeria_plot <- Nigeria %>% count(demog_income) %>% mutate(percentage = n / nrow(Nigeria))
ggplot(Nigeria_plot, aes(x = (demog_income), y = n, fill = demog_income)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
  ggtitle(paste0("Income - Nigeria (n = ", sum(dose_plot$n), ")"),
          subtitle = "How much do you earn in a year?") +
  theme_bw() +
  theme(plot.title = element_text(face = "bold"), legend.position = "none") +
  labs(x = "Income", y = "count")

Ghana
df_Ghana = df_retarget %>% filter(country_answer == "Ghana")
df_Ghana$demog_income[!df_Ghana$demog_income %in% c("< 5,000GH₵","5,000GH₵ - 9,999GH₵", "10,000GH₵ - 29,999GH", "30,000GH₵ - 49,999GH", "50,000GH₵-99,999GH₵", "> 100,000GH₵")] = NA
df_Ghana$demog_income = factor(df_Ghana$demog_income, levels=c("< 5,000GH₵","5,000GH₵ - 9,999GH₵", "10,000GH₵ - 29,999GH", "30,000GH₵ - 49,999GH", "50,000GH₵-99,999GH₵", "> 100,000GH₵"))
Ghana = df_Ghana %>% filter(!is.na(demog_income))
Ghana_plot <- Ghana %>% count(demog_income) %>% mutate(percentage = n / nrow(Ghana))
ggplot(Ghana_plot, aes(x = (demog_income), y = n, fill = demog_income)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
  ggtitle(paste0("Income - Ghana (n = ", sum(dose_plot$n), ")"),
          subtitle = "How much do you earn in a year?") +
  theme_bw() +
  theme(plot.title = element_text(face = "bold"), legend.position = "none") +
  labs(x = "Income", y = "count")

Other Variables

1. Heard “herd immunity” OR Not

df_retarget$herd_immunity[!df_retarget$herd_immunity %in% c("yes","no")] = NA
df_retarget$herd_immunity = factor(df_retarget$herd_immunity, levels=c("yes","no"))
herd_immunity_df = df_retarget %>% filter(!is.na(herd_immunity))
herd_immunity_df_plot <- herd_immunity_df %>% count(herd_immunity) %>% mutate(percentage = n / nrow(herd_immunity_df))
ggplot(herd_immunity_df_plot, aes(x = (herd_immunity), y = n, fill = herd_immunity)) +
  geom_bar(stat = "identity") +
  geom_text(aes(label = paste0(n, " (", round(percentage * 100,2), "%)")), vjust = -0.25) +
  ggtitle(paste0("Heard 'herd immunity' OR Not (n = ", sum(dose_plot$n), ")"),
          subtitle = "Have you heard of 'herd immunity'?") +
  theme_bw() +
  theme(plot.title = element_text(face = "bold"), legend.position = "none") +
  labs(x = "appointment needed", y = "count")

df_retarget %>%
  mutate(
    vax_status_retarget = case_when(
      vax_status_retarget == 0 ~ "unvaccinated",
      vax_status_retarget == 1 ~ "vaccinated"
    )
  ) %>%
  drop_na(vax_status_retarget, herd_immunity) %>%
  count(vax_status_retarget, herd_immunity) %>%
  arrange(vax_status_retarget) %>%
  ggplot(aes(vax_status_retarget, n, fill = herd_immunity)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "vaccination status",
    y = "Count",
    fill = "Heard 'herd immunity'",
    title = "Distribution of Heard 'herd immunity' by vaccination status"
  )

df_retarget %>%
  drop_na(country_answer, herd_immunity) %>%
  count(country_answer, herd_immunity) %>%
  arrange(country_answer) %>%
  ggplot(aes(country_answer, n, fill = herd_immunity)) +
  geom_col(position = "dodge", alpha = 0.8, color="black") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(
    x = "country",
    y = "Count",
    fill = "Heard 'herd immunity'",
    title = "Distribution of Heard 'herd immunity' by country"
  )