aa.completions <- read_excel("C:/Users/sharm/OneDrive/Desktop/Working files/McMcB/allergy.aware.completion.xlsx")
aa.completions$completions <- factor(aa.completions$completions, levels = c("One", "Two", "Three", "Four", "Five", "Six", "Seven"))

aa.agreement <- read_excel("C:/Users/sharm/OneDrive/Desktop/Working files/McMcB/allergy.aware.agreement.xlsx")
#aa.agreement$Response <- factor(aa.agreement$Response, levels = c("Strongly Agree", "Agree", "Disagree", "Strongly Disagree"))

aa.agreement.likert <- read_excel("C:/Users/sharm/OneDrive/Desktop/Working files/McMcB/allergy.aware.likert.xlsx")

aa.likert.long <- read_excel("C:/Users/sharm/OneDrive/Desktop/Working files/McMcB/allergy.aware.likert.long.xlsx")
completion.graph <- ggplot(aa.completions, aes(completions, thousands)) +
  geom_col(color="black", fill = "steelblue") + 
  geom_text(aes(label = thousands), vjust = -0.5) +
  labs(x = "Course completions", y = "# of completions, in thousands") +
  theme_classic()
completion.graph

## new df

Item <- c("I feel confident that I coul duse the EpiPen auto-injector in an emergency",
          "I feel confident that I could use the Allerject auto-injector in an emergency",
          "I feel confident that I could use the Emerade auto-injector in an emergency",
          "I feel confident that I can apply what I learned about prevention and avoidance strategies",
          "I feel confident that I can apply what I learned about emergency management",
          "This course can help to impact the health and safety of people at risk of anaphylaxis",
          "I would recommend this course to others")
strong_disagree <- c(4, 3, 3, 3, 4, 3, 3)
disagree <- c(0, 1, 1, 0, 0, 1, 1)
agree <- c(38, 45, 50, 35, 45, 43, 43)
strong_agree <- c(58, 52, 46, 61, 51, 54, 54)
  
aa.df <- data.frame(Item, strong_disagree, disagree, agree, strong_agree)

aa.df <- aa.df %>%
  rename("Strongly agree" = strong_agree,
         "Agree" = agree, 
         "Disagree" = disagree,
         "Strongly disagree" = strong_disagree)

likert(Item ~., aa.df, 
       as.percent = TRUE, 
       main = "Agreement survey responses, aggregated (2015-2022)",
       ylab = "Question",
       ylab.right = NULL,
       auto.key = list(columns = 2),
       scales = list(y = list(cex = 0.5)))