I have a large dataset, where I have a variable Q1
with 7 response/value options, and two groups (One
and Two
).
Q1<- c(6,4,2,4,7,1,4,7,4,5,4,4,2,6,1)
Group<- c(One, Two, One, Two,Two, Two, One, One, One, One, Two, One, One, Two, Two)
I'm trying to convert a simple frequency plot (number of observations in each response category by group) and instead plot the means with confidence intervals (as in the image below).
df1<- filter(df, Q1!="-99",df$Group=="One"|df$Group=="Two")
ggplot(data = df1, aes(x = Q1)) +
geom_bar(aes(fill = df1$Group), position = "dodge", stat="summary", fun.y="mean") + labs(title="Graph Title")
When i run this, I get the following error:
Error: stat_summary requires the following missing aesthetics: y
Any ideas are appreciated!