'ggplot for binary variables in r

I have a data table, with one of the columns labelled vowel_no (for number of vowels). There are only two possible values - 2.minus or 3.plus (i.e. 2 or less than 2 AND 3 or more than 3). Another of the columns in the data table is for books (there are five possible values for this i.e. five different books). I want to compare the ratios of words with 2 or fewer vowels to words with 3 or more vowels across the 4 books. I would like to end up with a ggplot that looks a bit like the ones on this page: R - ggplot showing distribution of binary flag variable (0/1) over time as normalized bar chart (%). I'm trying this but not having any luck.

ggplot(dt(aes(book,vowel_no, fill = vowelcount))+
  geom_bar()+
  ggtitle("vowel count")+
  xlab("name of book")+
  ylab("vowel counts")

Thank you



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source