i am trying to create a stacked barchart showing the proportion difference between n TenYearCHD and prevalentHyp. As the difference is small and i trying to add a data label showing the numbers so it will be clearer. anyone know how to add the data label in my R script?
data_no_na %>% select(prevalentHyp, TenYearCHD) %>% filter(TenYearCHD == "Yes" ) %>%
ggplot() +
geom_bar(position='Fill', aes(x = TenYearCHD, fill=factor(prevalentHyp))) +
labs(x= "TenYearCHD", y = "Proportion", title = "prevalentHyp and TenYearCHD", fill="prevalentHyp")