Good afternoon,
Can anyone give me a hint on this:
I would like to add in this plot not only the numbers of the Responder (on which the ORR % and n= X is based on), instead I would also like to add the number of Non-Responder. The issue is that since I filter on Responder in line 5, I do not longer have the Non-Responder data available. But I need to filter on Responder in line 5 because for the ORR in % I want it only for the Responder. Anyonw has one idea?
p<-metadata %>%
dplyr::count(Sex,side, ORR) %>%
dplyr::group_by(Sex) %>%
dplyr::mutate(prop = 100 * n / sum(n)) %>%
dplyr::filter( ORR == "Responder" )%>%
ggplot(aes(x =Sex, y = prop, fill =side)) +
geom_col(position = position_dodge()) +
geom_text(aes(label =paste0(round(prop),"%")),
position = position_dodge(.9), vjust = 1.2) +
geom_text(aes(label =paste0("n = ",n)),
position = position_dodge(.9), vjust = -0.5
)
Can't you instead of filtering on "Responder" just use a facet_wrap to show responders and non-responders separately? If your groups are exactly evenly sized, you can also calculate the non-responder rate as
group size - n responders in that group
.Thank you, I tried this. but then I get two plots. I just want to add the n of the Non-Responder in the plot.