Hi,
I am trying to make a line plot that shows the overall proportion of srh scores >1, and that for male and female sex separately as well. So, there will be three lines for each year point, overall, male, and female. I could make the plot for overall and for the two sexes, but I am not being able to combine them in the same plot.
I'd greatly appreciate if you could give me an idea about it. Below are the data and the codes:
ff %>% select(srh, year, sex)%>% filter(!is.na(srh)) %>%
filter(!is.na(sex)) %>%
group_by(year) %>% # Group by year only
summarize(prop_srh = sum(srh > 1, na.rm = TRUE) / n()) %>%
ggplot(aes(x = year, y = (prop_srh * 100)/100)) +
geom_line(color = "black")
Thanks so much for the detailed response. The chart is almost ok, I just want to add another line for the overall/combined trend of srh to understand who is better off between men and women. Please let know if you have any ideas about this.