I have a dataset that looks like this:
host | pathogen | doses | number of observations |
---|---|---|---|
bird | bacteria | 2 | 7 |
bird | virus | 3 | 4 |
bird | helminth | 5 | 6 |
bird | bacteria | 1 | 4 |
fish | virus | 6 | 8 |
fish | virus | 7 | 1 |
fish | bacteria | 8 | 4 |
mammal | virus | 4 | 2 |
Using ggplot and the stacked barchart, I would like to plot for each host-pathogen combination (on the x-axis), the "number of observations" of doses. So, for example, if the bird-bacteria combination is on the x-axis, on the y-axis I would like it to show that "doses=2" is observed 7 times and "doses=1" is observed 4 times.