From f0fecbdccf481613de4d2a161e6ef5df9015cbb8 Mon Sep 17 00:00:00 2001 From: brocatnw <36641074+brocatnw@users.noreply.github.com> Date: Fri, 27 Apr 2018 19:18:30 -0400 Subject: [PATCH] Corrected level error in agreementNA; added ggrepel command At line 19 in agreementNA, "slightly disagree" occurred twice; changed the second instance to "strongly disagree." At line 86, made Laura's suggested addition of repel command by changing "geom_text" to "geom_text_repel". Based on my testing, it isn't working, but that could be my testing. It may also need to go in the utilities file, where there are additional ggplot commands. --- R/make_wellbeing_chart.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/make_wellbeing_chart.R b/R/make_wellbeing_chart.R index 6dc3e24..aff91f9 100644 --- a/R/make_wellbeing_chart.R +++ b/R/make_wellbeing_chart.R @@ -16,7 +16,7 @@ make_wellbeing_charts <- function(data, mygroup, likert_scale) { "Disagree", "Strongly disagree") }else if (likert_scale == "agreementNA" ){ my_levels <- c("Strongly agree", "Agree", "Slightly agree", - "Slightly disagree", "Disagree", "Slightly disagree", + "Slightly disagree", "Disagree", "Strongly disagree", "Don't know/ NA") }else if (likert_scale == "class" ){ my_levels <- c("FY/ freshman", "Sophomore", "Junior", "Senior") @@ -83,7 +83,7 @@ make_wellbeing_charts <- function(data, mygroup, likert_scale) { theme(panel.grid.major.x = element_blank(), panel.grid.minor.x = element_blank())+ scale_fill_wellness()+ ggtitle(paste0(my_title))+ - geom_text(aes(label = paste0(round(perc_no_na,1),"%")), nudge_y=3)+ + geom_text_repel(aes(label = paste0(round(perc_no_na,1),"%")), nudge_y=3)+ scale_x_discrete(labels = function(x) str_wrap(x, width = 10)) }