How to change count to percentage

I am completely new to R. I am using R Markdown and Tidyverse for a uni assignment. Basically I really need help. I need to change this code so that it counts percentage rather than number of people. I have to use the code that I have provided or another form of plot using the same code structure if that makes sense!

data %>%
  ggplot(aes(Class)) + 
  geom_bar(aes(fill=choice_of_vote), alpha=0.2) +
  labs( title = "Voting Result from the Second Lisbon Referendum Based on Social Class", x = "Social Class", y = "Number of People", caption = "Source: Irish Social Science Data Archive (Second Lisbon Referendum (October 2009))") +
  theme_minimal() + geom_rug() +
  theme(legend.title = element_blank()) + coord_flip()

This is the graph I have produced, I just need to change the X axis count of people to percentage!

Pls help x

Try to use position="fill"

geom_bar(aes(fill=choice_of_vote), alpha=0.2, position="fill") +


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.