Table and PLot for COVID Survey Responses from the PIT Supplemental Survey

Question 1

# Libraries

library(readxl)
library(tidyverse)
library(gtsummary)
library(writexl)


# Import data

d_all <- read_excel("PIT_Winter_2022_Data.xlsx")
# wrangle data and write csv

# d_covid <- d_all |>
#  select(unique_id, age, gender, race, ethnicity,
#         do_you_consent_to_participate_in_this_assessment,
#         have_you_been_exposed_to_covid_19, have_you_ever_tested_positive_for_covid_19,
#         have_you_been_vaccinated_for_covid_19, how_many_covid_vaccine_doses_have_you_recieved,
#         are_you_willing_to_take_the_full_dose_of_the_covid_19_vaccine,
#         what_is_the_key_concern, #other_reason_not_willing_to_take_the_covid_19_vaccine)|>
#  filter(do_you_consent_to_participate_in_this_assessment == "Yes")|>
#  mutate(have_you_been_exposed_to_covid_19 = recode(have_you_been_exposed_to_covid_19, # "Off" = "No",
#                                                    "On" = "Yes"))
# write.csv(d_covid, file = "PIT Winter 2022 COVID Survey Data.csv")

# summarize data and create table

d_covid <- read_excel("PIT_Winter_2022_Data.xlsx")

gt_covid <- d_covid |>
    select(age, gender, race, ethnicity,
         have_you_been_exposed_to_covid_19, have_you_ever_tested_positive_for_covid_19,
         have_you_been_vaccinated_for_covid_19, how_many_covid_vaccine_doses_have_you_recieved,
         are_you_willing_to_take_the_full_dose_of_the_covid_19_vaccine,
         what_is_the_key_concern, other_reason_not_willing_to_take_the_covid_19_vaccine)|>
  tbl_summary(
    sort = list(c(age, gender,  race, ethnicity,
                  have_you_been_exposed_to_covid_19, have_you_ever_tested_positive_for_covid_19,
                  have_you_been_vaccinated_for_covid_19,
                  are_you_willing_to_take_the_full_dose_of_the_covid_19_vaccine) ~ "frequency"),
    missing = "no",
    label = list(age = "Age", gender = "Gender", race = "Race", ethnicity = "Ethnicity",
                 have_you_been_exposed_to_covid_19 = "Have you been exposed to COVID-19",
                 have_you_ever_tested_positive_for_covid_19 = "Have you ever tested positive for COVID-19",
                 how_many_covid_vaccine_doses_have_you_recieved = "How many COVID-19 vaccine doses have you recieved",
                 are_you_willing_to_take_the_full_dose_of_the_covid_19_vaccine = "If you have not been vaccinated, are you willing to take the full dose of the COVID-19 vaccine",
                 what_is_the_key_concern = "What is your main concern about the vaccine",
                 other_reason_not_willing_to_take_the_covid_19_vaccine = "Other concerns about the vaccine"))|>
  bold_labels()|>
  modify_caption("**COVID-19 Supplemental Survey**")|>
  modify_header(label ~ "**Total Number of Persons**")
 
gt_covid 
COVID-19 Supplemental Survey
Total Number of Persons N = 2121
Age 47 (34, 58)
Gender
Male 134 (63%)
Female 74 (35%)
Female Transgender 2 (0.9%)
Transgender 2 (0.9%)
Race
White 126 (59%)
Black, African American, or African 72 (34%)
Asian or Asian American 6 (2.8%)
Multiple races 5 (2.4%)
American Indian, Alaska Native, or Indigenous 2 (0.9%)
Black or African-American 1 (0.5%)
Ethnicity
Non-Hispanic/Non-Latin(a)(o)(x) 207 (98%)
Hispanic/Latin(a)(o)(x) 4 (1.9%)
Data not collected 1 (0.5%)
Have you been exposed to COVID-19
Off 86 (84%)
On 16 (16%)
Have you ever tested positive for COVID-19
No 63 (66%)
Yes 30 (32%)
Client doesn't know 1 (1.1%)
Client refused 1 (1.1%)
have_you_been_vaccinated_for_covid_19
Yes 63 (62%)
No 37 (37%)
Client refused 1 (1.0%)
How many COVID-19 vaccine doses have you recieved
0 4 (6.0%)
1 1 (1.5%)
1 Dose 15 (22%)
2 Doses 31 (46%)
3 Doses 14 (21%)
Client doesn't know 1 (1.5%)
Client refused 1 (1.5%)
If you have not been vaccinated, are you willing to take the full dose of the COVID-19 vaccine
No 37 (47%)
Yes 29 (37%)
Data not collected 6 (7.6%)
Client doesn't know 4 (5.1%)
0 1 (1.3%)
Client refused 1 (1.3%)
doesn't know 1 (1.3%)
What is your main concern about the vaccine
Believe the vaccine is not safe and may cause serious health complications 5 (15%)
Believe the vaccine is too new 1 (3.0%)
Believe the vaccine may infect them with COVID-19 3 (9.1%)
Believe the vaccine will not work/is ineffective 5 (15%)
Believe they are not at risk of getting COVID-19 or risk is low 3 (9.1%)
Fear of side effects 1 (3.0%)
Medical Condition 1 (3.0%)
No key reason 1 (3.0%)
Other 13 (39%)
Other concerns about the vaccine
As stated above, the guest is WILLING to take the vaccination 1 (7.7%)
Changes DNA/genetics 1 (7.7%)
Don't trust 1 (7.7%)
Don't trut it. Have natural immunity. 1 (7.7%)
Family issues. Father is catholic 1 (7.7%)
Guests states that he is immuned to COVID 19 1 (7.7%)
Hasn't Had Opportunity To Receive 1 (7.7%)
I don't like shots. 1 (7.7%)
Just doesn't want too 1 (7.7%)
Just haven't gotten to it 1 (7.7%)
Not sure what it is about. 1 (7.7%)
Religious beliefs 1 (7.7%)
Worried about side effects 1 (7.7%)

1 Median (IQR); n (%)

# Convert gt table to tibble and then to xlsx
tbl_covid <- d_covid |>
    select(age, gender, race, ethnicity,
         have_you_been_exposed_to_covid_19, have_you_ever_tested_positive_for_covid_19,
         have_you_been_vaccinated_for_covid_19, how_many_covid_vaccine_doses_have_you_recieved,
         are_you_willing_to_take_the_full_dose_of_the_covid_19_vaccine,
         what_is_the_key_concern, other_reason_not_willing_to_take_the_covid_19_vaccine)|>
  tbl_summary(
    sort = list(c(age, gender,  race, ethnicity,
                  have_you_been_exposed_to_covid_19, have_you_ever_tested_positive_for_covid_19,
                  have_you_been_vaccinated_for_covid_19,
                  are_you_willing_to_take_the_full_dose_of_the_covid_19_vaccine) ~ "frequency"),
    missing = "no",
    label = list(age = "Age", gender = "Gender", race = "Race", ethnicity = "Ethnicity",
                 have_you_been_exposed_to_covid_19 = "Have you been exposed to COVID-19",
                 have_you_ever_tested_positive_for_covid_19 = "Have you ever tested positive for COVID-19",
                 how_many_covid_vaccine_doses_have_you_recieved = "How many COVID-19 vaccine doses have you recieved",
                 are_you_willing_to_take_the_full_dose_of_the_covid_19_vaccine = "If you have not been vaccinated, are you willing to take the full dose of the COVID-19 vaccine",
                 what_is_the_key_concern = "What is your main concern about the vaccine",
                 other_reason_not_willing_to_take_the_covid_19_vaccine = "Other concerns about the vaccine"))|>
  bold_labels()|>
  modify_caption("**COVID-19 Supplemental Survey**")|>
  modify_header(label ~ "**Total Number of Persons**")|>
  as_tibble()

write_xlsx(tbl_covid, "PIT WInter 2022 COVID Survey Table.xlsx")
d_doses <-  d_covid |>
  select(unique_id, how_many_covid_vaccine_doses_have_you_recieved, have_you_been_vaccinated_for_covid_19)|>
  mutate(how_many_covid_vaccine_doses_have_you_recieved =
           recode(how_many_covid_vaccine_doses_have_you_recieved, "Client doesn't know" = "Unknown",
                  "Client refused" = "Unknown"))|>
  mutate(doses = case_when(how_many_covid_vaccine_doses_have_you_recieved == "1 Dose" ~ "1 Dose",
                           how_many_covid_vaccine_doses_have_you_recieved == "2 Doses" ~ "2 Doses",
                           how_many_covid_vaccine_doses_have_you_recieved == "3 Doses" ~ "3 Doses",
                           how_many_covid_vaccine_doses_have_you_recieved == "Unknown" ~ "Unknown",
                           have_you_been_vaccinated_for_covid_19 == "No" ~ "Unvaccinated",
                           have_you_been_vaccinated_for_covid_19 == "Client refused" ~ "Unknown"))|>
  filter(have_you_been_vaccinated_for_covid_19 != "Client refused",
         doses != "Unknown")|>
  drop_na(doses)

d_sum_doses <- d_doses|>
  group_by(have_you_been_vaccinated_for_covid_19, doses)|>
  summarise(Count = n_distinct(unique_id),
            Percent = Count/93)

doses_plot <- ggplot(d_sum_doses, aes(x = have_you_been_vaccinated_for_covid_19,y = Count, fill = doses, label = Count)) +
  geom_bar(stat = "identity") +
  geom_text(size = 5, position = position_stack(vjust = 0.5)) +
  labs(fill = "COVID-19 Vaccine Doses",
       title = "Have you been vaccinated for COVID-19?")+
  xlab("")+
  ylab("")
  
doses_plot

ggsave(plot = doses_plot, filename = "vaccine_doses_plot.png")