Of course, it can be done. Let me show an example.
I want to show the average of displ for each value of cyl in mpg dataset.
Create new dataframe for easy implemnetation.
df_new = mpg %>% group_by(cyl) %>% summarise(avg_displ =median(displ))
ggplot(df_new,aes(cyl,avg_displ)) +geom_bar(stat = "identity")