I have a table with the following data:
> head(sweet) interval urgency success 1 3138 761 1 2 3210 2189 1 3 3243 1256 1 4 8776 823 1 5 3094 1405 1 6 3137 1062 1
Success takes the values 0 and 1. I am looking for a success rate for different urgency values, so I draw a histogram as follows:
ggplot(sweet, aes(x=urgency, fill=success==0)) + geom_histogram(position='fill')

Now I want to look at the success rate for a combination of urgency and interval, but this approach does not help:
ggplot(sweet, aes(x=urgency, y=interval, fill=success==0)) + geom_bin2d()

Is there a way to make padding a constantly displayed success / failure ratio instead of a useless binary value in the 2d bin section?
source share