I am working on a project and trying to make some graphics. I am pretty new to coding, so any help would be much appreciated. I created a graph, but the labels at the bottom are overlapping, so I tried adding in geom_text_repel() and geom_label_repel() by themselves at different places in the code and I keep getting the error message: "Error in FUN(X[[i]], ...) : object 'prop' not found". I also tried adding ggrepel to the aes layer and I got the error: "Error: stat_count requires the following missing aesthetics: x". Does anyone have any ideas on how to get ggrepel to work with my code or another way to have the labels not overlap? Here is my code:
df %>%
filter(!is.na(`Self Reported Race (roll up)_Cleaned`)) %>%
ggplot() +
aes(
x = C19_Employment,
y = ..prop..,
group = `Self Reported Race (roll up)_Cleaned`,
fill = `Self Reported Race (roll up)_Cleaned`,
na.rm = TRUE
) +
labs(
title = "Employment Status by Self-Reported Race",
x = "Employment Status",
y = "Proportion of Race",
fill = "Self-Reported Race"
) +
geom_bar(position = "dodge", na.rm = TRUE) +
theme(legend.position = "bottom")
And an image of the original graph: (Original Graph