I'm tryng to do a bar plot with percentages instead of counts, and I've tried this:
ggplot(data = newdf3) +
geom_bar(mapping = aes(x = key, y = ..prop..,fill=value,group = 1), stat = "count",position=position_dodge()) +
scale_y_continuous(labels = scales::percent_format())
but apparently "group=1" is not working because this is what it returns:
and if I don't use "group=1" it returns:
here's a sample of data I'm using:
key value
1 Before
1 After
1 During
1 Before
2 Before
2 After
3 During
...
Can someone help me with this?