If you'd like to do this in ggplot
, an API change was made to geom_histogram()
that leads to an error: https://github.com/hadley/ggplot2/issues/1465
To get around this, use geom_bar()
:
animals <- c("cat", "dog", "dog", "dog", "dog", "dog", "dog", "dog", "cat", "cat", "bird")
library(ggplot2)
# counts
ggplot(data.frame(animals), aes(x=animals)) +
geom_bar()