I am currently working on a project regarding buying behaviour.
First I need to filter the data set because I only want to look at data which has a specific variable at one. Then I want to plot the data from this specific variable, distinguishing between A and B on x axis and having The Units on the y axis, unfortunately units are not the same for each data point so I cannot use a bar plot. My code currently is:
df1 %>%
filter(SES == "1") %>%
ggplot(aes(x = brand, y = unit)) +
geom_col() +
labs(y = "Units sold",
x = "Brand", title="Buying Behaviour SES 1") +
theme_bw(base_size = 15)
This code works, but it does not show the results in percentage but rather in absolut value. I need to compare different SES and the absolute values differ strongly so I want to go with percentages instead. How would you guys change to percentage?
aes(y = (..count..)/sum(..count..))
using this does work for a bar plot if i leave out units, but I need to leave units in.