I have this code:
tbl <- with(mydata, table(Species, Depth))
library(ggplot2)
ggplot(as.data.frame(tbl), aes(factor(Depth), Freq, fill = Species))
geom_col(position = 'dodge')
and this dataframe
Site Depth Substrate PoePres HaliPres Species
1 2 0.5 Sand 0 1 DMonte
2 2 0.5 Sand 0 1 DMonte
3 2 0.5 Sand 0 1 DMonte
4 2 0.5 Sand 0 1 DMonte
5 2 0.5 Sand 0 1 DMonte
6 2 0.5 Sand 0 1 DSandi
7 2 0.5 Sand 0 1 DSandi
8 2 0.5 Sand 0 1 DSandi
9 7 0.6 Sand 0 1 DMonte
10 7 0.6 Sand 0 1 DMonte
11 7 0.6 Sand 0 1 DMonte