用平均值绘制条形图

问题描述

我正在通过 y 绘制 classquantity 的分面条形图。这是生成数据帧的代码

set.seed(99)
y<-sample(1:100,50,replace=TRUE)
class<-rep(c(letters[1:5]),times=10)
quantity<-as.factor(rep(c(5,10,15,20,25),each=10))
df<-data.frame(y,class,quantity)

这是生成图表的代码

ggplot(df,aes(class,y))+geom_bar(stat="identity")+
  facet_grid(.~quantity)

当前的情节给了我 yclass 的总和。我想通过y找到classquantity的均值。我该怎么做?

谢谢!

示例取自 here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)