Following the R cookbook example I created a graph by only using one variable and have it's count be on the y axis:
ggplot(data_set, aes(x = species)) + geom_bar()
However when I try to add labels on the bar chart with the
geom_text()
function to show the percentage of each bar I keep running into errors like:
Error: geom_text requires the following missing aesthetics: y
or
Error: Aesthetics must be either length 1 or the same as the data (31357)
I tried suggestions like: How to add percentage or count labels above percentage bar plot?
but they keep giving me these errors. I think it is a special case as I am only using one column and having geom_bar() automtically count it for me.
This feels very simple to do but nothing I do works, any help would be appreciated.