From 07b8af9188b6519e0b551f692760f73b7a9728b8 Mon Sep 17 00:00:00 2001 From: Ali Abbas Date: Wed, 6 Nov 2024 20:19:29 +0000 Subject: [PATCH] Update summary_script.R Use count instead --- summary_script.R | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/summary_script.R b/summary_script.R index 182e31b..a06d527 100644 --- a/summary_script.R +++ b/summary_script.R @@ -99,15 +99,18 @@ combine_summary <- bind_rows(states_base_sum, states_cyc_sum) |> mutate(scenario plotly::ggplotly( - combine_summary |> - filter(freq >= 1L) |> - ggplot() + - aes(x = name, y = freq, fill = scenario) + - geom_col(position = "dodge2") + - scale_fill_hue(direction = 1) + - theme_minimal() + - theme(axis.text.x = element_text(angle = 90L)) + - facet_wrap(vars(value)) + combine_summary %>% + filter(freq >= 2) %>% + ggplot() + + aes(x = name, y = nv, fill = scenario) + + geom_bar(stat = "summary", fun = "sum", position = "dodge2") + + scale_fill_hue(direction = 1) + + coord_flip() + + theme_minimal() + + geom_text(aes(label = nv), + position = position_dodge(width = .9), size = 2) + + facet_wrap(vars(value)) + + labs(x = "diseases", y = "values") )